All things Shopify and commerce
We are a collective store and I want to be able to offer discounts from the store, but when I do an order discount the discount gets evenly split between all of the products (and product vendors). Is there a way for the discount to come off the order but not affect the product price?
Added note, these are for an in store POS system.
Apply the discount at the order level, without altering the individual product prices.
You can add a "discount line item" in the checkout process to reduce the total order price. This way, the product prices remain the same, and vendors receive the correct revenue for their products.
Is that the same as a "Custom Cart Discount"? I don't see "discount line item" listed.
A custom cart discount applies a percentage or fixed amount discount at the checkout stage. Shopify natively supports this via discount codes or automatic discounts.
The discount is applied to the total order value, which gets distributed across all the products in the cart. This may reduce the final amount each vendor receives in a multi-vendor store.
You can write a custom script that applies a discount at the cart level without changing individual product prices. This ensures that the discount reduces the total cost but doesn't impact the product breakdown for vendors.
Example of script:
DISCOUNT_RATE = 0.20
Input.cart.line_items.each do |line_item|
next if line_item.variant.product.gift_card?
line_item.change_line_price(line_item.line_price * (1 - DISCOUNT_RATE), message: "20% Cart Discount")
end
Output.cart = Input.cart
Oh man, this is way over my head! 😬
Thank you for all your help! Are you able to tell me where I can locate the "discount line item" that you previously mentioned?
Log in to Your Shopify Admin Panel: Go to your Shopify store admin by logging in at your-store-name.myshopify.com/admin.
Navigate to Discounts:
Create a New Discount:
Configure the Discount:
Save the Discount:
Log in to Your Shopify Admin Panel: Use the same link as above to access your admin panel.
Navigate to Discounts:
Create or Edit Discounts:
Use Shopify Scripts:
Write the Script:
I also have Plus and I would like to give a discount not on the entire cart but only on the product I decide to give a discount on, what script method?
# Define the product you want to discount
DISCOUNT_PRODUCT_ID = 1234567890 # Replace with the actual product ID
DISCOUNT_PERCENT = 20 # Define the percentage discount
# Loop through the items in the cart
Input.cart.line_items.each do |line_item|
product = line_item.variant.product
# Apply discount only to the specified product
if product.id == DISCOUNT_PRODUCT_ID
line_item.change_line_price(line_item.line_price * (1 - DISCOUNT_PERCENT / 100.0), message: "Custom Discount Applied")
end
end
# Output the modified cart
Output.cart = Input.cart
I don't want to select a specific variant, so I would like to give discount sometimes separately in the cart for some products.
The issue is that I want to offer a discount option for all my products, but I won't be offering a discount on all of them during the sale.
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024