This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Add: Cross-sells for the Store API Cart response. #6635
Merged
wavvves
merged 11 commits into
trunk
from
add/6555_cross-sells_products_to_cart_endpoint
Jul 13, 2022
Merged
Add: Cross-sells for the Store API Cart response. #6635
wavvves
merged 11 commits into
trunk
from
add/6555_cross-sells_products_to_cart_endpoint
Jul 13, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wavvves
changed the title
Added Cross-sells object and schema for the API Cart response.
Add: Cross-sells object and schema for the API Cart response.
Jun 28, 2022
Size Change: 0 B Total Size: 876 kB ℹ️ View Unchanged
|
wavvves
added
focus: rest api
Work impacting REST api routes.
block: cart
Issues related to the cart block.
labels
Jun 28, 2022
senadir
reviewed
Jun 28, 2022
11 tasks
nielslange
reviewed
Jun 30, 2022
… replaced by ProductSchema itself. Cross-sells are direct product representation, and extending this goes out of scope for the task at hand.
wavvves
changed the title
Add: Cross-sells object and schema for the API Cart response.
Add: Cross-sells for the Store API Cart response.
Jul 8, 2022
tarunvijwani
approved these changes
Jul 8, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on it @wavvves! Let's merge it. 👍
nielslange
approved these changes
Jul 12, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected! Let's ⛴ it, @wavvves!
wavvves
added
skip-changelog
PRs that you don't want to appear in the changelog.
type: enhancement
The issue is a request for an enhancement.
and removed
skip-changelog
PRs that you don't want to appear in the changelog.
labels
Jul 18, 2022
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.
focus: rest api
Work impacting REST api routes.
type: enhancement
The issue is a request for an enhancement.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the Cross-Sells products are only available in the shortcode-based Cart, but not in the Cart block. To make the Cross-Sells products available in the editor when viewing the Cart block, we need to add the Cross-Sells product list to the Store API Cart response.
Fixes #6555
Accessibility
prefers-reduced-motion
Other Checks
Testing
Automated Tests
User Facing Testing
/wp-json/wc/store/cart
/wp-json/wc/store/cart
and verify the cross-sell product exists in the array for cross_sellsWooCommerce Visibility
Performance Impact
The cart endpoint will now feature Cross-Sell Products. Cross-Sell products exist within the cart object as product ids, which means for each one we will be querying the database for the WC_Product object.
Although this has a negative impact on the endpoint's performance, it is negligible since we're bringing this on par with the shortcode version which does the same (Actually, I believe the shortcode version does duplicated queries, but that still needs proper investigation as I only bumped into it while researching for this PR)
Changelog