Skip to content

Conversation

@matt-h
Copy link

@matt-h matt-h commented Oct 14, 2025

Fix PHP error: Uncaught TypeError: WooCommerce\PayPalCommerce\Button\Helper\CartProductsHelper::add_variable_product(): Argument #3 ($post_variations) must be of type array, string given, called in wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Helper/CartProductsHelper.php on line 117

Issue: #3684


Description

Make sure that variations is always an array before calling add_variable_product

Steps to Test

Payload can be sent to /?wc-ajax=ppc-simulate-cart
Like this:
{"nonce":"f98ec5b666","products":[{"id":"57585","quantity":"1","variations":null,"extra":{}}]}
With variations being null

Documentation

  • This PR needs documentation (has the "Documentation" label).

Changelog Entry

Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted.

Closes #3684 Fix Uncaught TypeError on simlate cart calls.

…ble_product

Fixes woocommerce#3684

Fix PHP error: Uncaught TypeError: WooCommerce\PayPalCommerce\Button\Helper\CartProductsHelper::add_variable_product(): Argument woocommerce#3 ($post_variations) must be of type array, string given, called in wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Helper/CartProductsHelper.php on line 117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fatal error on Simluate cart when no variations sent

1 participant