Showing the Subtotal on the Product page

Ela_V_TSM
Explorer
50 2 7

Hi there! We're currently developing a website here: https://www.kibeland.com/

 

We were planning on doing something like this for the product page:

Annotation 2020-03-24 171520.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Has anyone successfully put the Subtotal for a certain quantity of a product onto their product page?

 

Any help would be greatly appreciated.

Email: ela.v.tsm@gmail.com
0 Likes
Pallavi
Shopify Expert
1330 179 218

Hello Ela_V_Tsm, 

 

Do you want to display the same sub-total amount that will be displayed on the cart, ie. if there are two products in the cart and if you are adding the third product then on pdp it should display the total of all the three products. Is it something like this you want to implement.  

Want to modify or develop new app, Hire us.
If helpful then please Like and Accept Solution .
Email: support@zestard.com
Shopify Apps URL :- https://apps.shopify.com/partners/zestard-technologies
Custom Modifications Into Shopify Theme | Shopify Private App | SEO & Digital Marketing
0 Likes
Ela_V_TSM
Explorer
50 2 7

Yes, something like that. Do you know how I can implement it?

Email: ela.v.tsm@gmail.com
0 Likes
jayanetty
Pathfinder
116 12 35

Hello, 

I'd do this via JQuery. 
Get the text value of the price and quantity field on change. 
Multiply the values and show them in a new div.

Something like this

<script>
  $('.qty').change(function() {
    var qty = $('.qty').val();
    var price = $('.price').text();
    var newPrice = price.replace(/[^0-9\.]/g, '');
    var subtotal = (qty * newPrice);
    $('.subtotal').text(subtotal);
  }); 
</script>
0 Likes
iq180
New Member
6 0 0

@jayanetty

Your jQuery looks promising but I am new to code.

Would you mind provide some step by step instructions?

0 Likes
jayanetty
Pathfinder
116 12 35

@iq180 ,

Yes surely. Please drop me a private message with the store details.

0 Likes