This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
Add to Cart with Options block > Update the block to rely on dedicated render methods instead of WooCommerce core templates. #9502
Labels
With the removal of the global
$product
variable from theAdd to Cart with Options
block on #9457 , follow-up changes are required to ensure this block works as expected.Initially, this block relied on the native WooCommerce's templates for rendering the
Add to Cart button with Options
button. The problem is those templates all rely exclusively on the global$product
variable for generating content, and in the absence of it, a Fatal error is thrown:Call to a member function is_purchasable() on string in /srv/htdocs/wp-content/plugins/woocommerce/templates/single-product/add-to-cart/simple.php:22
Based on the outcome of the discussion on #9457 , an altered and consolidated version of all add-to-cart form templates needs to be developed for rendering the Add to Cart with Options block.
The consolidated templates should include:
woocommerce/templates/single-product/add-to-cart/external.php
woocommerce/templates/single-product/add-to-cart/grouped.php
woocommerce/templates/single-product/add-to-cart/simple.php
woocommerce/templates/single-product/add-to-cart/variable.php
woocommerce/templates/single-product/add-to-cart/variation-add-to-cart-button.php
The text was updated successfully, but these errors were encountered: