Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Cart block - Third party plugin compatibility - the price shows as "discounted" while it is not #10433

Closed
marcusig opened this issue Aug 1, 2023 · 1 comment · Fixed by #11386
Assignees
Labels
block: cart Issues related to the cart block. block: checkout Issues related to the checkout block. block: mini-cart Issues related to the Mini-Cart block. type: bug The issue/PR concerns a confirmed bug. type: community contribution type: good first issue The issue is a good candidate for the first community contribution/for a newcomer to the team.

Comments

@marcusig
Copy link

marcusig commented Aug 1, 2023

Describe the bug

When the cart item price is modified by a third party plugin and the price is different from the original, it shows as discounted, even though it is not. (see screenshot)

To reproduce

Steps to reproduce the behavior:

  1. Go to https://demos.mklacroix.com/custom-laptop/
  2. Select some options with an extra price
  3. Add to cart
  4. Visit the cart comparison page (https://demos.mklacroix.com/cart-block-vs-cart-shortcode/)

Expected behavior

Either the original price should only be displayed if there is an actual discount applied, or there should be an option to not display it.

Screenshots

image

Environment

WordPress (please complete the following information):

  • WordPress version: 6.3
  • WooCommerce version: 7.9
  • WooCommerce Blocks version: 10.7.1
  • Site language: EN
  • Any other plugins installed: Product configurator for WooCommerce and add-ons. The Extra price add-on changes the item price.

Additional context

As the developper of the plugins mentioned above, this issue will be part of a series of issues brought forward in an effort to make them compatible with the cart and checkout blocks.

@marcusig marcusig added the type: bug The issue/PR concerns a confirmed bug. label Aug 1, 2023
@marcusig marcusig changed the title Cart block: the price shows as "discounted" it is not Cart block - Third party plugin compatibility - the price shows as "discounted" while it is not Aug 1, 2023
@nielslange
Copy link
Member

nielslange commented Aug 9, 2023

Hello @marcusig,

Thanks for reaching out. I was able to reproduce this issue by adding the following snippet to my site using the Code Snippets plugin:

function calc_price( $cart_object ) {
    foreach ( $cart_object->get_cart() as $hash => $value ) {
        $value['data']->set_price( 50 );
    }
}
add_action( 'woocommerce_before_calculate_totals', 'calc_price' );

I see that this issue affects both the Cart and the Checkout block.

Cart block:

Screenshot 2023-08-09 at 15 51 41
Checkout block:

Screenshot 2023-08-09 at 15 53 05

I'll move this issue to our backlog now.

@nielslange nielslange added block: cart Issues related to the cart block. block: checkout Issues related to the checkout block. block: mini-cart Issues related to the Mini-Cart block. type: good first issue The issue is a good candidate for the first community contribution/for a newcomer to the team. labels Aug 9, 2023
@tarhi-saad tarhi-saad self-assigned this Oct 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: cart Issues related to the cart block. block: checkout Issues related to the checkout block. block: mini-cart Issues related to the Mini-Cart block. type: bug The issue/PR concerns a confirmed bug. type: community contribution type: good first issue The issue is a good candidate for the first community contribution/for a newcomer to the team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants