【问题标题】:How to move the product price next to add to cart button如何将产品价格移动到添加到购物车按钮旁边
【发布时间】:2020-06-26 18:00:34
【问题描述】:

我正在尝试将产品价格移动到添加到购物车按钮旁边。我尝试了以下方法,它将价格移动到按钮下方,而不是添加到购物车按钮旁边。有什么想法吗?

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 30 );

【问题讨论】:

  • 能多发些源码吗?

标签: javascript css woocommerce hook


【解决方案1】:

通常您会复制 woocommerce 模板并对其进行调整。

但如果这不可行,您可以尝试不同的方法。

我在这个例子中使用StoreFront WooCommerce theme

找到 woocommerce 价格类名 - 这里有 woocommerce-Price-amount


并通过在 style.css 中添加 CSS 来重新定位它 - 在这种情况下,我们需要

position: absolute;
transform: translate(281px, 147px);

【讨论】:

  • 请勿发布代码、数据、错误消息等的图片 - 将文本复制或输入到问题中。 How to Answer
  • @Rob 这是对必须适应手头情况的技术的解释。我们在问题中没有足够的信息来提供详细的现场说明。
  • 如果您没有足够的信息,您需要为此投票关闭问题。
  • 感谢 Silviu 的明确解释。很有帮助。
猜你喜欢
  • 2021-09-20
  • 1970-01-01
  • 2018-08-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-03
  • 2011-12-19
  • 1970-01-01
相关资源
最近更新 更多