Handlebars on Cart.html - handlebars.js

Is there any way to access a product with variations/options individual weight?
Currently have an old script pulling a basic product (no variations/options) through custom fields. Now I have products with variations all with different weights, so the custom fields solution no longer works...
Ideally I want to pull the product options weight to add to my script to total the cart's weight. Tried ?debug=context at the end of a localhost URL and could not find product option weight to be available on the cart page- are there other options to work around this??
I am on BigCommerce Cornerstone theme

From what I understand by reading your post, the best way to accomplish your goal will be with the storefront GraphQL API. Using GraphQL you can query each product in the cart and include the variant data with the weight. This will allow you to get the weight for all of the variants in the order and add them up to get the total.
I'd definitely suggest checking out the BigCommerce GraphQL Documentation for more information, as well as the Code Examples.

Related

How to display specific WooCommerce variable product attribute together with it's related price?

I have a WooCommerce store for footwear with mainly variable products that I used on them (size attribute), I consider the user experience a lot that's why I'm trying to find a way to display each variable product size attribute with its related price" similar to the below images:
Most of the stores that have this functionality are not WooCommerce and were built using other technology and frameworks, I tried a lot to search for something to achieve similar results with WooCommerce but without any luck. Is this possible to be achieved on WooCommerce?
I will really appreciate and help.

Woocommerce add-to-cart URL with product bundle

I am following this guide in order to use an add-to-cart URL to add a bundled product to my cart. My goal is to bundle 4 products into ONE and using the add-to-cart URL for this purpose:
Looking at the solution, it seems quite trivial to construct such a link and I am quite sure I did it correctly:
https://myshopurl.com/cart?add-to-cart=77229&quantity[6674]=1&quantity[7214]=1&quantity[5780]=1&quantity[5892]=1
In this case, 77229 is the ID of the bundled product while 6674, 7214, 5780 and 5892 are single products that I want to bundle into 77229
I get as far as adding the products into the cart all together but they are not bundled. It seems that the bundled product is ignored in this case.
I am not sure what I am doing wrong but something is not working as expected.
Is there any best practise on how to solve this problem? Do I need to add custom code to functions.php to make this work?
Thanks in advance.
You're using the solution for Grouped Products, which are not the same as Product Bundles. With Product Bundles, you add the products you want bundled using the Product Data meta box in the editor. At this point, you may be able to use a simple add-to-cart URL if you are bundling simple products. I haven't tested this. If you are bundling variable products, the add-to-cart URL becomes complicated. See https://www.alternativeradio.org/products/alem002-alem001/ for an example:
https://www.alternativeradio.org/products/alem002-alem001/?add-to-cart=11061&bundle_variation_id_61=5266&bundle_attribute_pa_format_61=mp3&bundle_variation_id_62=5262&bundle_attribute_pa_format_62=mp3
I don't even remember how I reverse engineered this.

How to pass two sets of posts to wordpress template

Our website currently has functionality that allows us to choose content for a newsletter and it generates two RSS feeds based on the selected data - one for articles chosen to appear in the newsletter and another for products that were chosen to appear in the newsletter. We then use those two RSS feeds to assemble our newsletter in the tools at our email service provider.
Now we're moving to a new email service provider that doesn't offer this RSS functionality, so we need to change the way wordpress renders it so that there is one template that combines both the products and article data into one formatted newsletter. And being a wordpress newbie, I'm having trouble understanding how I can pass two sets of posts to the template for rendering.
The way it currently works with the RSS feeds, is there is a switch in the query to pull the content to change the query depending on whether the feed being viewed is the products feed or the articles feed. This querying is altered via the "pre_get_posts" filter.
Please let me know if you have any suggestions of how these two sets of data can be combined into one template. Thank you for your help.
Unless anyone has a better solution, I think the way I'm going to approach this is to modify my "pre_get_posts" action to do two queries - first for articles and next for products - and then create a new query using post__in and orderby=>'post__in' which should preserve the order in which they were added to the query.
This way, I'll know to treat the first X posts as articles and the remainder as products.
This article was helpful in finding the solution of orderby=>'post__in' : http://www.tamaraolsondesigns.com/tips-and-tricks/how/

How to set multiple currency and geo location with algolia search in woocommerce?

We're using algolia for our website with woocommerce. We've used currency switcher plugin on which works with geolocation but on search and category pages where data comes from algolia it doesn't change the price there and show base currency.
So, how can we enable geolocation with algolia and set multi currency based on Geo location?
I've tested most of the plugins. they work but just not on the algolia result page. so looking for a solution which can also work on algolia result page.
Unfortunately the Algolia plugin doesn't support any multi-currency plugin. If you want to make it work you will have to edit Algolia's plugin.
The solution would really depend on how the multi-currency plugin works:
if the plugin is able to figure out the conversion in the browser, then chances are you can work something out quickly by editing the template file.
If everything happens in the backend, you would need to figure out how to get all currencies and push them along every product record.
In general, I think it's easier to index the price in each currency and display it without calculation in the template.

Woocommerce Custom Orders

I am new to woocommerce plugin development. I am making a website for a taylor, in which it is required to have custom sizes for different shirts, etc. My question is that how could I add the custom functionality like this, in which customers could add their own sizes and we can receive their orders.
I have searched all over the internet but could not find the good resource which could solve my problem. For the reference I am uploading the following image of custom order page
Are these measurements automatically incorporated in the price? or is your system just for taking orders online and the tailor replies with a custom price quote?
Easiest way is to just add this to the checkout process.
http://www.globussoft.com/how-to-add-custom-field-on-woocommerce-checkout/

Resources