Add discount code in cart or auto-show order summary in checkout

Michael_Thomas
Tourist
10 0 6

So shopify wants to hide the discount code entry in the order summary during checkout on mobile which is massively stupid, especially considering there’s posts about this going back several years... That said, I’ve not found any of them to be super useful.

Does anyone have a fix for this?

Either adding a discount code field in the shopping cart (probably ideal), or making the order summary visible by default.

0 Likes
PaulNewton
Shopify Partner
2583 136 472

Prompt for discount on /cart page and apply it with the discount parameter ?discount= 

Or make automatic discounts that fit with what your mobile audience tends to buy.

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes
Michael_Thomas
Tourist
10 0 6

Latter isn't possible. Former is promising, how is that done?

0 Likes
PaulNewton
Shopify Partner
2583 136 472

@Michael_Thomas wrote:

Latter isn't possible. Former is promising, how is that done?


Either add it as a link /cart?discount_code=CODE, or make a form with an input box that submits it to /cart

 

The latter is possible just not 100% foolproof by knowing your audience using analytics ,reports ,channels, etc then create an automatic discount to suit.

Make a collection with products more likely to be bought by mobile users than desktop users, etc.

Example if product A is sold on Facebook and most facebook traffic is mobile discount that product and probably remove it from the online store channel to lower change of desktop users getting discount.

 

https://help.shopify.com/en/manual/discounts/automatic-discounts 

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes
Michael_Thomas
Tourist
10 0 6

Automatic discounts is not an option.

How do I prompt for a discount code in the cart and pass the value to the URL string?

I've added:

            <p class="cart-attribute__field">
              <label for="discountcode">Discount Code</label>
              <input id="discountcode" type="text" name="attributes[Discount Code]" value="{{ cart.attributes["Discount Code"] }}">
            </p>

But not sure where to go from there.

0 Likes
PaulNewton
Shopify Partner
2583 136 472

update previous post for clarity tried to see if I had a snippet or shopify had a tutorial /shrug

 

 

If you use an input you need to put in a form to submit the cart, and it needs to submit as a parameter not a cart attribute

{% assign DISCOUNT_CODE = "???" %}
<form action="/cart" method="post">
           <p class="cart-attribute__field">
              <label for="discountcode">Discount Code</label>
              <input id="discountcode" type="text" name="discount" value="{{DISCOUNT_CODE}}">
            </p>
</form>

If you place this anywhere besides the cart page and need to stay on the page you either need to use the ajax api, or use the return_to parameter to redirect from the cart back to the original page. 

 

Other cart template info https://shopify.dev/docs/themes/theme-templates/cart-liquid#going-to-checkout

https://community.shopify.com/c/Shopify-Design/Cart-Use-permalinks-to-pre-load-the-cart/td-p/613702#... 

 

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes