wordpress - Elementor - 在添加到购物车旁边动态添加“立即购买”按钮
问题描述
我正在尝试在自定义单个产品页面的elementor中添加一个立即购买按钮,因此有两个按钮:
添加到购物车立即购买(这将重定向到结帐并跳过购物车)我仍然希望添加到购物车以正常运行。
我怎样才能做到这一点?非常感谢。
解决方案
After a little research I came up with a solution to this problem
using PHP code snippet
<?php
$product = wc_get_product();
$id = $product->get_id();
echo home_url('/checkout/?add-to-cart='.$product->id);
?>
then i linked the button to this code using shortcode
推荐阅读
- pyspark - 将 Spark 与 Elasticsearch 集成
- c# - Visual Studio 2019 中断已处理的异常 (C#)
- android - 用数据库中的不同对象填充数组
- ruby-on-rails - Ruby on Rails:带有关键字和日期范围的搜索表单不起作用
- spring-data-jpa - 如何使用 spel 调用非静态方法来获取 redis 密钥?
- c# - 向量算术运算的实现 с#
- javascript - 将 EventListeners 添加到新创建的 DOM 元素
- python - sklearn.metrics mean_absolute_error 计算
- javascript - undefined is not an object (evalating 'this.props.navigation.navigate') - React Native while navigation based on functions approach
- haskell - 有没有一种漂亮/glib 的方法来将一个 curry-ed 函数限制为 Haskell 中另一个函数的图形?