简体   繁体   English

如果选择了变体,则产品页面上产品价格下的动态文本

[英]Dynamic Text under Product Price on Product page in case a variation is selected

How can I create a text A under the product price on the product page in case a variation is not selected.如果未选择变体,如何在产品页面上的产品价格下创建文本 A。 When a variation is selected I would like to have another text B. To be exact: Text A: incl.选择变体后,我想要另一个文本 B。确切地说:文本 A:包括。 VAT free premium shipping Text B: incl.免增值税高级送货文本 B:包括。 VAT + free premium shipping(in black color and bold).增值税 + 免费高级送货(黑色和粗体)。

The text should go under the price.文宜go下价格。

Thank you very much.非常感谢你。

You can do that with javascript exemple:您可以使用 javascript 示例来做到这一点:

 function AddTVA(){ var checkBox = document.getElementById("myCheck"); var text = document.getElementById("text"); if (checkBox.checked == true){ document.getElementById("price").innerHTML = "12.00"; } else { document.getElementById("price").innerHTML = "10.00"; } }
 <div> <h2>Product name</h2> <p><span id="price">10.00</span>$</p> <input type="checkbox" id="myCheck" onclick="AddTVA()"/> <label for="myCheck">Add TVA</label> </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 隐藏产品可变价格,直到在 WooCommerce 中选择所有变体字段 - Hide product variable price until all variation fields are selected in WooCommerce 计算价格并显示在 WooCommerce 产品单页下的价格(简单价格,可变价格) - Calculate price and display on WooCommerce product single page under price (simple price, variable price) Woocommerce - 如何将变化数据传输到 function 以在单个产品页面上实时显示价格计算公式? - Woocommerce - How can I transfer variation data to a function for a live display of the price calculation formula on the single product page? 产品和价格的动态项目选择 - dynamic item selection of product and price 在产品页面上显示所有 WooCommerce 变化信息 - Display All WooCommerce Variation Information on Product Page 只要在导轨中选择产品,就设置价格值 - Set price value, whenever product is selected in rails 产品页面上的价格格式问题(getPriceHtml) - Issue with price format on Product Page (getPriceHtml) WooCommerce-在产品页面上显示不含税的价格 - WooCommerce - Display Price Without Tax on Product Page 下拉产品,在文本字段中输入价格 - Drop down product, put price in text field 根据所选产品从数据阵列填充价格 - Populate the price from data array depending on selected product
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM