Hi,
Generally, WordPress doesn’t support javascript in sidebar widgets hence the issue.
I can suggest two solutions:
1) Use the “Shortcodes in Sidebar” plugin and add single product widgets by means of a shortcode [ecwid_product]
– Install and activate the “Shortcodes in Sidebar” plugin: https://ww.wp.xz.cn/plugins/shortcodes-in-sidebar/
– Add a Text widget to your sidebar and put Ecwid’s product shortcode in it, e.g. [ecwid_product id=12345] . See shortcode format here: https://help.ecwid.com/customer/portal/articles/1085017-wordpress-downloadable-#Howtoembedasingleproductonapageorpostofmysite
2) Use product browser instead of single product widgets and the add to bag buttons will automatically appear on product details pages. By the way, why don’t you use it?
Thanks.
FYI
I create http://www.ebcteflcourse.com/ecwidmadridtest/
It contains the embed code and also a shortcode pointing to the embed code.
As you will see, nothing appears.
Yes and here’s the code it creates.
I used the one you suggested. It didn’t work. I then tried another. It didn’t work either.
Here’s the code they created.
<aside id=”text-55″ class=”widget widget_text”>
<div class=”textwidget”>
<div class=”ecwid-shopping-cart-product”>
<div class=”ecwid ecwid-SingleProduct ecwid-Product ecwid-Product-51574744″ itemscope itemtype=”http://schema.org/Product” data-single-product-id=”51574744″>
<div itemprop=”picture”></div>
<div class=”ecwid-title” itemprop=”title”></div>
<div itemtype=”http://schema.org/Offer” itemscope itemprop=”offers”>
<div class=”ecwid-productBrowser-price ecwid-price” itemprop=”price”></div>
</div>
<div itemprop=”options”></div>
<div itemprop=”addtobag”></div>
</div>
</div>
</div>
</aside>
<aside id=”shortcode-widget-2″ class=”widget shortcode_widget”>
<div class=”textwidget”>
<div class=”ecwid-shopping-cart-product”>
<div class=”ecwid ecwid-SingleProduct ecwid-Product ecwid-Product-51574744″ itemscope itemtype=”http://schema.org/Product” data-single-product-id=”51574744″>
<div itemprop=”picture”></div>
<div class=”ecwid-title” itemprop=”title”></div>
<div itemtype=”http://schema.org/Offer” itemscope itemprop=”offers”>
<div class=”ecwid-productBrowser-price ecwid-price” itemprop=”price”></div>
</div>
<div itemprop=”options”></div>
<div itemprop=”addtobag”></div>
</div>
</div>
</div>
</aside>
solved – conflict with “Autoptimize” plugin
Oh, thanks.
What did that plugin do? Did it strip the codes?
We will think about how to make Ecwid plugin not affected by Autoptimize.
hiya guys;
I’m AO’s developer. I guess there was inline JS that got moved by AO, which broke things? You can easily exclude any JS (inline or linked) from optimization by adding it to the JS optimization exclusion list, cfr. the FAQ for more info.
Do let me know if I can be of any help to make Ecwid not affected by AO.
have a nice weekend,
frank
Hi Frank,
Thanks for joining the thread.
We found the issue can be fixed by adding Ecwid scripts to the exclusions list. This is a good solution for some particular site.
As to the general solution, is there a chance you can add Ecwid scripts to the built-in exclusions so that they are never affected on any site?
Thanks.
Hiya Makfruit;
Although AO indeed comes with a list of built-in exclusions, I’m trying to limit this as much as possible (my goal is to remove a lot of what is in there for the next major version, actually).
A better approach could be for ECWID to hook into AO’s autoptimize_filter_js_exclude filter, adding the ECWID JS to the comma-seperated string there. An example of how to do that can be found in autoptimize_helper.php_example.
Don’t hesitate to ping me if you need additional input!
Kind regards,
frank
Hi Frank,
Okay, thank you, we will look into it.
Hi Everyone,
We fixed the issue in the latest version of Ecwid plugin (v.3.3).
Thanks for your help with this.