Clear Price in Shopify - shopify

I have a problem with the price filters. I have a product that costs € 1,430.20 but I would like to obtain a value of 1430 therefore without currency, without decimals and without punctuation.
I tried with {{current_variant.price | money_without_currency | money_without_trailing_zeros}} but it doesn't work. Ideas?

Related

Bigquery REGEX getting numbers only that followed by certain text (unit)

i have tables that contain product name. i want to extract the numbers only from it. but only numbers followed by the unit (certain text) ex: gr, kg, ml, pcs.
product name | Extracted
milk 30ml | 30
Cigarette 20pcs | 20
Sugar 50gr | 50
1990 chocolate 10gr | 10
Is there any way to only getting number that followed certain text we desired? i just know how to extract numbers only but the last product will getting error.
Thank you
We can use REGEXP_EXTRACT here with a capture group:
SELECT product, REGEXP_EXTRACT(product, r'([0-9]+)(?:l|ml|gr|g|mg|[a-z]+s)\b') AS Extracted
FROM yourTable;

Shopify Math liquid rounding not returning the same value when using automatic discount

I am using the following code:
{{ product.price | times: 0.90 | money_with_currency}}
I also have a 10% automatic discount enable. The price returned using the code above is not the same as the price returned using automatic discount:
Product cost |$35.49 |$34.41 |$46.59 |$52.99
price using code: |$31.94 |$30.97 |$41.93 |$47.69
10% discount in cart |$31.95 |$30.97 |$41.94 |$47.70
I would like to display the same amount using the code as the prices shown in cart
pic attached

Shopify Math logic not working properly

on my store when using custom template i got a price based on some values
Price * 2 it works
Example.
17.99 * 2
I got in cart: 35.98, this is good.
But when using:
17.99 * 0.5, should be 8.99
i got: 17.99
Why?????????? Any ideas?
Im adding as value this way:
<option value="{{ qty | times:0.50 }}" data-qua="{{ qty | times:0.50 }}">{{ inches }}m</option>
Well, i have found that due to a Shopify limitation you can not use decimals as quantity, so cannot do PRICE * 0.5
If is there a any solution to this let me know.
Sell by unit pricing. As you figured out, no shopping cart lets you sell 0.3456 of something. While you can buy .0005342 of a bitcoin, you cannot sell non-integer anything with Shopify. So adjust your formula to sell 1 thing at $.003456 or whatever... and collect your fortune that way.

shopify liquid: plus shipping cost not working

I want to multiply the subtotal price by 21% and then add the shipping costs. Because the shipping costs are variable I use the following code.
{{ order.subtotal_price | times:1.21 | plus:shipping_method.price | money }}
But the shipping costs aren't added.
The example code in the documentation states you can divide a price by product.compare_at_price so I thought it should work the same for shipping_method.price.
What am I doing wrong? Or is it even possible?
You are using the wrong object. What you're actually looking for is order.shipping_price:
{{ order.subtotal_price | times:1.21 | plus:order.shipping_price | money }}

OpenCart - how to calculate VAT correctly?

Here's an example of the issue at hand:
A product costs 81.25 (that is price including 20% VAT, in other words, 81.25 is equal to 67.71+13.54). I've set the price calculations to the best of my belief (from Extensions->Order Totals) and within Shopping Cart, we'd see the following break-down:
A table of the product with thumbnail, description, quantity, price: and last cell says 81.25. Below that:
Sub-total: 67.71 (that is price without VAT)
+20% VAT: 13.54 (that is the VAT, achieved through Taxes)
-10% Discount: -8.13 (all products over $50 receive 10% discount, that is, 10% off of 81.25)
TOTAL: 73.12
Unfortunately, our customers are very sensitive to VAT, so the calculation should break-down to:
-10% discount: 8.12 (that is 10% off the full price of 81.25)
Sub-total: 60.94 (that would be the full price,81.25, minus the 10% discount or 8.12 first and excluding the 20% VAT second)
+20% VAT: 12.19
TOTAL: 73.12
As you can see, the Total is the same, but the VAT is different. I've tried a different Total Order from the OpenCart admin, but if I start with Discount, it does not have a previous value to discount in the first place and returns 0.
A possible theoretical solution in my mind, perhaps if Total could be duplicated somehow, renamed and inserted hidden in the very first position (so that it would equal 81.25 at the beginning, then discount etc.) that might work. I would really appreciate your ideas.
I see what's Your point. But If I buy something from Your store for the end-price of 73.125 (that is 81.25 - 10% discount) while there is 20% VAT, the price without VAT is 60.9375 and the VAT is indeed 12.1875. This is simply because the discount is applied to the sub-total price (end-price of the product including VAT) and not to the price without VAT.
If You would like to do it Your way, thus subtracting 10% discount from the netto price of the product (excluding VAT), You would have to apply 10% discount on the VAT as well:
price excl. VAT -10% discount: 81.25/1.2 * 0.9 = 67.708333 * 0.9 = 60.9375
VAT = 13.541666 (BUT SEE point 3)
VAT - 10% discount = 13.541666 * 0.9 = 12.1875
Your counting is incorrect simply because if we count Your results (that were very wrongly rounded), we would end up with the final price of 60.9375 (price excl. VAT - 10% discount) + 13.541666 (VAT w/o 10% discount) = 74.4791666 ~ 74.48
AND
74.48 !== 73.12
BUT counting the discounted price + discounted VAT
60.9375 + 12.1875 = 73.125 which is correct result!
I hope now is it clear that OC counts the result correctly while Your idea is wrong...
It should really go
Subtotal (67.71)
Discount (-6.77)
VAT (13.54)
Total (73.12)
The subtotal is actually the "total" you mentioned you wanted to have and rename. It's not possible to have the total show before the taxes etc are applied for the simple fact that the order total is calculated in order of those totals
Uncle Fester, I think you are right.
We have to have in mind two groups of buyers, retail and wholesale.
If you tell a guy in retail that he has 10% discount, it should mean that if the final price (w/ VAT) was, lets say USD 100, he would expect that the discounted price should be USD 90.
On the other hand, for a wholesale customer, it is a bit different. Wholesale customers are interested in prices w/o VAT only, so, a price for him is USD 90 + VAT and when you tell him he has 10% discount, he counts on USD 81 w/o VAT.
Back to the VAT calculation, lets look at the same price of a product in amount of USD 90 w/o VAT and USD 100 w/ VAT. Lets say we are giving 10% discount to both customer groups.
Retail customer is counting on a price of USD 90 (USD 75 + VAT), while
Wholesale customer counts on a price of USD 97.2 (USD 81 + VAT).
So, that is the initial approach to the issue.
Next, something that I do not understand is the following:
basically, any tax is to be paid in a certain percentage of the final sum, dont you agree?
So, if the final price of the product (w/o VAT) is USD 100, then the VAT is USD 20 (if rate is 20%), and final amount is USD 120. If however, one receives 10% discount, his bill is now USD 90 + VAT, or USD 99 is the final sum. In other words, VAT amount in Invoice should always be the exact percentage of the goods that is precised in the law.
If it stays written that it is USD 13,54 - it is NOT 20% of the net, but the gross amount of the goods. In this case, VAT grows to 22,2%!?! And all of you are saying that is how it should be???
I really do not understand this...
There are 2 ways of calculating VAT-
Method 1) Applying VAT on each item
Method 2) Applying VAT on the subtotal
For my country in Malaysia, the VAT has to be calculated using Method 1. Consequently, the accounting (XERO) and billing (TradeGecko) software I use also uses Method 1. Unfortunately, OpenCart uses Method 2, and I am still searching for the solution for OpenCart that allows me to use Method 1.
Method 1 and Method 2 will give you different VAT amount, simply because of where the rounding of the VAT amount is taking place. For Method 1, the rounding of VAT takes place at the item level, while in Method 2, the rounding takes place at the sub-total level.
If only OpenCart has a simple radio button that allows us to choose either one, that should please almost 99% of the users.