【发布时间】:2021-01-04 17:59:18
【问题描述】:
对于我的产品,我需要创建自定义选项(使用 ACF pro 插件)。自定义选项可以是复选框或单选按钮,每个选项都与一个数字值(插件价格)相关联。
我想要做的是使用 Ajax 将数字字段添加到产品总价格中。 这是我的 ACF html 代码:
<div class="option-wrapper">
<?php if( have_rows('product_options') ): while ( have_rows('product_options') ) : the_row(); ?>
<div class="color-wrapper">
<?php if( have_rows('couleur') ): while( have_rows('couleur') ): the_row();?>
<div class="color-dot" style="background-color:<?php echo get_sub_field('type_couleur');?>"></div>
<?php endwhile; endif; ?>
</div>
<div class="stockage-wrapper">
<?php if( have_rows('stockage') ): while( have_rows('stockage') ): the_row();?>
<div class="stockage-dot">
<label class="stockage-label">
<input type="radio" name="stockage" id="<?php echo get_sub_field('id_stockage');?>" value="<?php echo get_sub_field('id_stockage');?>" class="stockage-radio"/>
<span><?php echo get_sub_field('valeur_stockage');?></span>
</label>
</div>
<?php endwhile; endif; ?>
</div>
<?php endwhile; endif; ?>
</div>
Link to my test single product page
知道如何实现它吗? 最好的问候
【问题讨论】:
标签: wordpress woocommerce advanced-custom-fields acfpro