javascript code on Shopify 2.0 custom_liquid block in a section (Product Page)

GoodfyLabs
Shopify Partner
65 0 10

Hi Experts, 

I am customizing a Shopify 2.0 theme for the first time and trying first on the Dawn Theme.

 

I need to add a block to Main Product section to expose a "Rating Snipp" from a third party .

 

ON the old days we just add any code like bellow  to  product-template.liquid

<script> 

......

</script> 

 

Does anybody knows how to adapt this to Shopify 2.0 Themes ?
Thanks in advance 

 

 

William Alencar
GoodFy Labs
Brazilian Shopify Experts
Getting Satisfied Customers around the World
Skype : william.br1
Replies 3 (3)

PaulNewton
Shopify Partner
6339 580 1350

If the third party has a shopify app they should be encouraged to use app-blocks.

 

If it's a script,css , or html hook meant to be embedded use either a custom-liquid block or section in the product templates theme settings.

Or in some cases a dynamic source for and text input setting.

 

If it needs to be inside the buy buttons form for the dawn based themes you will have to add it to the respective area in main-product.liquid section.

 

If it needs to be a literal setting block you'll have to learn to implement them.

https://shopify.dev/docs/themes/architecture/sections

https://shopify.dev/docs/themes/architecture/sections/section-schema#blocks 

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


GoodfyLabs
Shopify Partner
65 0 10

Hey @PaulNewton  thanks a lot per response ...

The full code is some js operations and a code from a cdn

I will check docs links ... Thanks a lot 

<script type="text/javascript">
window._trustvox = [];
_trustvox.push(['_storeId', 'ID-LOJA']);

_trustvox.push(['_productId', productId]);
_trustvox.push(['_productName', productName]);
_trustvox.push(['_productPhotos', [url.image]]);
</script>
<script async="true" type="text/javascript" src="//static.trustvox.com.br/sincero/sincero.js"></script>

 

William Alencar
GoodFy Labs
Brazilian Shopify Experts
Getting Satisfied Customers around the World
Skype : william.br1
PaulNewton
Shopify Partner
6339 580 1350

Yes just add that to a custom-liquid block in the themes settings and test.

https://help.shopify.com/en/manual/online-store/themes/theme-structure/sections-and-blocks#working-w... 

 

Good hunting.

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org