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

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

Activity

  1. 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.[/+] on May 18, 2023
  2. self-assigned this
    on May 18, 2023
  3. added
    type: bug
    on May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

block: add to cart formtype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions