Shopify - Is there a way to offer discount after taxes are calculated - shopify

I have a collection of items which has a 13% tax. So if you buy $1 in goods, your final charge would be $1.13 because of this tax.
I give users the option to return certain items while purchasing others (imagine returning the keg of beer while buying another).
The problem, however, is that the "return" (where I subtract $X from the checkout) affects the checkout pre tax. So if the total was $100, which is $113 after tax, my current code would deduct $50 pre-tax, which would affect the tax I need to collect.
Is it possible to have the items purchased + tax show in the checkout, and subtract the "returns" after the price plus tax is calculated?
I have looked at this link identifying a similar issue and people claiming they can solve it. The only solution provided by shopify was to pay $2000/month to get access to checkout.liquid where * maybe * I could solve the problem.

Unfortunately, your question is unclear. You have to understand how Shopify works to accomplish certain goals. One, you cannot mess with the pricing of goods or taxes. About the only thing you can offer customers are discount codes.
Anything that gets committed to checkout is out of your control. You cannot adjust anything in the checkout, with the exception being, Plus merchants can indeed script checkout, and even alter the Liquid.
Until you are more clear about what you are attempting, I suggest you ensure that whatever you are doing, the cart is fair game, do as you wish. Have the customer replace one item with another. Submit to checkout. Be done.
Sure, there are cheesy Apps that help fake things financially by using discount codes, but that is often a road to more problems than it is worth.

we have tried this but it did not work for us.
We then ended up disabling the tax altogether
The items were calculated inclusive of tax and we would then provide a tax invoice separately using API

Related

Scheduling Price Changes in Shopify Plus where my ERP can't

I have a retail website built in Shopify Plus that is fed by an ERP. A couple times a month at least, I have sale events where some (not all) items get varying levels of discounts (I'll call this my store-wide sale), but my ERP doesn't have the ability to schedule temporary price changes.
I also have unrelated discounts that happen at the item level outside the store-wide sale cycle, so the solution needs to be able these to the store-wide sale price for that item and choose the lower of the two.
I can manually change all my prices with immediate effect in the ERP to start the sale and then manually do it again to put them back to the way it was, but that's time consuming, and normally needs to happen outside business hours. If I change the price in Shopify, the ERP just over-writes them.
Is this possible? Is there a solution short of implementing a PIM that will allow me to schedule my price changes in this way?
I was thinking of potentially keeping my store-wide discounts in a metafield and/or a tag on each item and using a script to do the math, pick the best price, and change the price at the line level in cart and maybe Javascript to over-write price displayed on the PDP and PLP to show that same price.
I realised a lot of merchants needed this, so I built an app for this. I'm sure it will do exactly as you need.
https://apps.shopify.com/simple-simons-price-scheduler
If you need additional features, just submit a request via the contact form. I'm pretty quick to implement features if I feel they're beneficial.

Shopify - New order using the Shopify API - how to know tax and shipping?

We have built an e-commerce web application (Node backend, Vue frontend). We process the payment using Stripe, but many brands have asked us if the order and inventory control can be done in Shopify. We are trying to figure out the best way integrate a payment module into Shopify so that the brand can manage the fulfilment and inventory through Shopify.
It seems we should use the Order API to create an order and mark it as paid. But how do we know that the product is in stock, and what are the cost for shipping and tax from Shopify when creating the order? I think we can use the Product API to get inventory levels, but where is the shipping and tax endpoints?
If I understand the Order API correctly, we need to tell Shopify what are the shipping costs and tax costs, when a new order is created. Is that right? How could we possibly know those figures? Seems like there should be an endpoint to calculate shipping costs and get a product's tax rates so that we can then pass those figures back into the Order API. Am I missing something?
I thought maybe we are supposed to create an order that has financial_status: pending first to get shipping and tax rates back (does it even give you those?), then update the order to either cancel_reason: customer or cancel_reason: inventory if those rates are too expensive and the order is declined? But surely we need to know what shipping methods are available to the customer in order to tell Shopify which one to use, right? Or does it by default choose the cheapest one when creating an order?
Notes:
We know the customers shipping address
We don't know where the product is warehoused (Shopify does I think)
We don't know the weights or dimensions of the product (Shopify does I think)
This answer is a little bit late, but i hope, i can help others that are struggling with the same issue.
First i would recommend to set up all Shipping Rates and Taxes in Shopify. There are plenty of manuals to achieve this:
https://help.shopify.com/manual/taxes#general-process-to-set-up-taxes
https://help.shopify.com/manual/shipping/rates-and-methods/calculated-rates
After this there are different possibilities to calculate your shipping and tax cost.
Your shipping cost can you get via the active_shipping API, which can be found here:
https://github.com/Shopify/active_shipping
Or the following Shopify Application: https://apps.shopify.com/boxify
However, you may need to know size and storage location for theese solutions.
The taxes can you get via the country in the Admin API, there is a specific key-value pair for this:
https://help.shopify.com/api/reference/country
I hope that's enough information to get closer to solving the issue, for at least someone.

Shopify - Is there a way to determine the type of discount code in the api response

When discount codes are applied to orders the way they are brought in in an order is a 2 field array, code and amount. Although, in the admin interface a Shopify user can choose whether or not the type of code is an absolute amount, percent, or free shipping.
In the api response is there a way to determine whether the code used was for free shipping or one of the others? This is causing issues with our sync because taxes are handled different in different locations for shipping costs compared to general order line items.
Thank you,
Brandon
Short answer: No, you can't tell the difference.
Long answer: Internally, free shipping codes are actually applied to items in the cart up to the value of the shipping method selected, and then the shipping amount is applied on top.
The upshot of this is that there is no difference between the three discount types as stored on Shopify. They're all just dollar amounts taken off the order subtotal. Therefore you can't tell whether the shipping was discounted because it never is.

How should admin change the shipping method

I am developing an ecommerce store for a client. I am not sure how to go about handling the shipping methods.
Lets say that there are two shipping methods:
Ground shipping - $10
Express shipping - $30
Buyer comes and selects Ground shipping.
However before buyer hits the checkout button the admin changes the price of ground shipping to $20. Since buyer agreed to pay $10 buyer should only pay $10.
Also for security reason when checkout is hit the order_id is sent to the server and the total price is recalculated. When this recalculation happens then shipping price has changed from $10 to $20. This is not good.
To solve this I have two thoughts.
1) When buyer selectsground shipping then clone all the attributes of the shipping to somewhere and now these values belong to order. This is less than ideal since shipping could get complicated with different shipping rates for domestic vs international etc. And cloning all those attributes might not be possible.
2) Do not allow admin to change and existing shipping method. Admin can only create new shipping method.
I tried to look at how other open source ecommerce applications handle it but could not get any meaningful information.
Option #2 is what needs to happen. Allow the admin to change the existing shipping method only when the site is down for a scheduled maintenance so you are not changing anyone's pricing costs on them "behind their back" and also so that the customers know in advance the site is going down for maintenance and maybe in the maintenance message you can mention that shipping prices may be being updated during this downtime / maintenance period.
Changing the costs of shipping on a live site while people are making purchases and shopping is a bad idea.
3) Log price changes with timestamps on server, so when recalculation is performed, the old (buyer checkout) price is calculated.

Zen Cart - Itemized Shipping Totals

I'm currently finishing up a fairly customized Zen Cart setup for a client and while overall the site is 99% functional when it comes to ordering, I'm having an issue on the checkout page where the customer is able to see the item totals and the sales tax, along with the grand total.
The issue however is that the grand total accounts for the shipping rate (as shown below the order form) however I'd like to also have it displayed above the sales tax line.
Does anyone know which files I'd need to access to edit the cosmetics of the checkout total?
Aside from that, I'm pretty sure I'd be able to plug in the custom values since I have the variable names on hand from coding the site till now.
Thanks very much in advance for any assistance,
The order in which the totals are displayed is determined by their sort order on the Admin >> Modules >> Order Totals page.
I've changed them this way a few times for clients, but you do need to be check that the tax calculations still work (there have been quite a few changes to recent versions to try to get that right in all cases).