harriette Posted November 20, 2021 Posted November 20, 2021 Hi All, We have integration built that is working well and uses the Orders API to populate sales order lines in our back end system. We use the SKU to map the item from Squarespace to our items in our back end system and through the Orders API get the QTY and the SKU of the item sold. However I am having issues getting the discount to populate for each sale line. I.e. if we have a discount applied to one product in squarespace how can I get the discount that was related to that item only and use it to populate the discount field for the sale line in our back end system. The Orders API shows the discount lines separate to the line items so we can get the total discount and apply it to the whole invoice but we dont want any discount applied to items that weren't discounted. The Transaction API has the discount per salesLineItems but the only id is the the sales line item id which doesn't match back to anything on the Orders API. Hope this is clear what we are trying to do and equally hoping there is method to do this. Any help much appreciated.
paul2009 Posted November 21, 2021 Posted November 21, 2021 14 hours ago, harriette said: I am having issues getting the discount to populate for each sale line. I.e. if we have a discount applied to one product in squarespace how can I get the discount that was related to that item only and use it to populate the discount field for the sale line in our back end system. In Squarespace you can create sale pricing for individual products, as well as discounts that apply to entire orders, individual products and product categories. Sale Pricing If you're referring to the discount that is applied to a product when you place the product 'on sale' and populate the 'sale price' field, this discount is already applied to the "unitPricePaid" field. You cannot retrieve the original price from Squarespace so you'd need to use the value from your backend system to calculate any discount that was applied. Commerce Discounts If you're referring to promotions that you set in Commerce > Discounts, these are applied to the overall order and are not reflected in the price of individual line items, even if the conditions required the purchase of a specific product. These discounts are shown in "discountLines". Squarespace doesn't provide a way of matching these discounts to individual products that were purchased so if you want to calculate these, you'll need to write your own logic (in the integration you have built) to calculate these for each discount/ promotion. Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
harriette Posted November 21, 2021 Author Posted November 21, 2021 Thanks for the reply and thanks for confirming - i thought this was the case but wanted to check.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.