CATALOG-2408 - Bulk Pricing updates per-variant#1167
CATALOG-2408 - Bulk Pricing updates per-variant#1167mjschock merged 1 commit intobigcommerce:masterfrom bookernath:bulk-pricing-tiers
Conversation
|
Autotagging @bigcommerce/storefront-team @davidchin |
package.json
Outdated
| "license": "MIT", | ||
| "dependencies": { | ||
| "@bigcommerce/stencil-utils": "^1.0.10", | ||
| "@bigcommerce/stencil-utils": "bookernath/stencil-utils#d263f2ef03aa88e1361c8b4331204e4e4e8bd5e4", |
There was a problem hiding this comment.
this gets replaced with a new version once the utils PR is merged.
| const $messageBox = $('.alertMessageBox'); | ||
| const item = $('[name="item_id"]', $form).attr('value'); | ||
|
|
||
| utils.api.productAttributes.optionChange(item, $form.serialize(), (err, result) => { |
There was a problem hiding this comment.
looking at the new optionChange api, it seems that we don't need to pass null here
| utils.api.productAttributes.optionChange(productId, $form.serialize(), 'products/bulk-discount-rates', (err, response) => { | ||
| const productAttributesData = response.data || {}; | ||
|
|
||
| const bulkPricingHtml = response.content || {}; |
There was a problem hiding this comment.
could we match the productAttributesData here, like so:
const productAttributesContent = response.content || {};
...
updateView(data, content)
etc.
| } | ||
|
|
||
| // If Bulk Pricing rendered HTML is available | ||
| if (content) { |
There was a problem hiding this comment.
does this work? i thought it was grabbing a field off of content... like this instead:
updateView(data, content) { // content will be {} if response.content is empty above
...
if (content.bulkPricingContent) { // or whatever it's called
viewModel.$bulkPricing.html(content.bulkPricingContent)
There was a problem hiding this comment.
Content returns a blank string which evaluates to false if there are no tiers. Content is returned as another top-level property, but it's just a string and not an object.
|
@mjschock I think I've addressed most of your feedback if you wanna take a peek. Also rebased to pull in the JQ update. |
What?
Price Lists support different bulk pricing tiers for each variant, so we need to update the viewModel whenever these tiers change.
Tickets / Documentation
Screenshots (if appropriate)