From 3a740db2897d3cdb7ed8f1b78589135b337591eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=BCsken?= Date: Fri, 28 Feb 2025 09:03:13 +0100 Subject: [PATCH] Fix Shipping dropdown not displayed because of an authentication error --- .../src/Endpoint/UpdateShippingEndpoint.php | 2 +- .../resources/js/modules/Helper/ShippingHandler.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/ppcp-blocks/src/Endpoint/UpdateShippingEndpoint.php b/modules/ppcp-blocks/src/Endpoint/UpdateShippingEndpoint.php index c8e0417ab..43032c588 100644 --- a/modules/ppcp-blocks/src/Endpoint/UpdateShippingEndpoint.php +++ b/modules/ppcp-blocks/src/Endpoint/UpdateShippingEndpoint.php @@ -23,7 +23,7 @@ use WooCommerce\PayPalCommerce\Button\Endpoint\RequestData; */ class UpdateShippingEndpoint implements EndpointInterface { const ENDPOINT = 'ppc-update-shipping'; - const WC_STORE_API_ENDPOINT = '/wp-json/wc/store/cart/'; + const WC_STORE_API_ENDPOINT = '/wp-json/wc/store/v1/cart/'; /** * The Request Data Helper. diff --git a/modules/ppcp-button/resources/js/modules/Helper/ShippingHandler.js b/modules/ppcp-button/resources/js/modules/Helper/ShippingHandler.js index ae86ddea0..03952b14a 100644 --- a/modules/ppcp-button/resources/js/modules/Helper/ShippingHandler.js +++ b/modules/ppcp-button/resources/js/modules/Helper/ShippingHandler.js @@ -21,8 +21,8 @@ export const handleShippingOptionsChange = async ( data, actions, config ) => { credentials: 'same-origin', headers: { 'Content-Type': 'application/json', - 'X-WC-Store-API-Nonce': - config.ajax.update_customer_shipping.wp_rest_nonce, + 'Nonce': + config.ajax.update_customer_shipping.wp_rest_nonce, }, body: JSON.stringify( { rate_id: shippingOptionId, @@ -106,9 +106,9 @@ export const handleShippingAddressChange = async ( data, actions, config ) => { credentials: 'same-origin', headers: { 'Content-Type': 'application/json', - 'X-WC-Store-API-Nonce': - config.ajax.update_customer_shipping - .wp_rest_nonce, + 'Nonce': + config.ajax.update_customer_shipping + .wp_rest_nonce, }, body: JSON.stringify( { shipping_address: cartData.shipping_address,