Do not consider needShipping from single page

This commit is contained in:
Narek Zakarian 2024-07-26 18:06:09 +04:00
parent 4a72743d0f
commit b96c87597a
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7

View file

@ -139,7 +139,7 @@ class Renderer {
};
// Check the condition and add the handler if needed
if ( this.defaultSettings.should_handle_shipping_in_paypal && this.defaultSettings.needShipping ) {
if ( this.shouldEnableShippingCallback() ) {
options.onShippingOptionsChange = ( data, actions ) => {
let shippingOptionsChange =
! this.isVenmoButtonClickedWhenVaultingIsEnabled(
@ -227,6 +227,12 @@ class Renderer {
return venmoButtonClicked && this.defaultSettings.vaultingEnabled;
};
shouldEnableShippingCallback = () => {
console.log(this.defaultSettings.context, this.defaultSettings)
let needShipping = this.defaultSettings.needShipping || this.defaultSettings.context === 'product'
return this.defaultSettings.should_handle_shipping_in_paypal && needShipping
};
isAlreadyRendered( wrapper, fundingSource ) {
return this.renderedSources.has( wrapper + ( fundingSource ?? '' ) );
}