Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.
This repository was 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

Description

@nefeline

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions