Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Fix issues with add-to-cart on listing when product has super_attributes #698

Merged
merged 4 commits into from
Jan 15, 2025

Conversation

Jade-GG
Copy link
Collaborator

@Jade-GG Jade-GG commented Jan 9, 2025

Within the context of the product listing:

  • The add to cart button would always redirect to the product page even if you have options selected, making the options shown in the listing completely useless. With this PR, it will actually add the product to your cart if you have selected an option for each of the super_attributes.

  • Selecting an option that should change the product image didn't actually change the product image, even though those images were all getting indexed into ES. This PR makes the product image listen to the selected options appropriately.

  • The add to cart button was always hidden if you didn't elect to show swatches in the product listing, whereas that option is completely unrelated to whether or not the button should be shown. With the previous point I've had to move a few things around, along with which I've changed this behavior to be more in line with what you would expect.

return this.simpleProduct?.thumbnail || this.simpleProduct?.images?.[0] || this.product?.thumbnail
},

shouldRedirectToProduct: function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we also listened to config.show_swatches should we check this here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle it shouldn't really matter for this check. If you have a product that doesn't have all options filled, it doesn't matter whether the options are shown or not.

@royduin
Copy link
Member

royduin commented Jan 15, 2025

Conflict 😇

@royduin royduin merged commit 27b517d into master Jan 15, 2025
12 checks passed
@royduin royduin deleted the feature/listing-addtocart branch January 15, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants