Skip to content
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

Closed
nefeline opened this issue May 18, 2023 · 0 comments · May be fixed by #9494
Assignees
Labels
block: add to cart form type: bug The issue/PR concerns a confirmed bug.

Comments

@nefeline
Copy link
Member

With the removal of the global $product variable from the Add 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
@nefeline nefeline changed the title Add to Cart button with Options block > Update the block to rely on dedicated render methods instead of WooCommerce core templates. Add to Cart with Options block > Update the block to rely on dedicated render methods instead of WooCommerce core templates. May 18, 2023
@nefeline nefeline self-assigned this May 18, 2023
@nefeline nefeline added block: add to cart form type: bug The issue/PR concerns a confirmed bug. labels May 18, 2023
@gigitux gigitux closed this as completed Jun 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: add to cart form type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
2 participants