相关疑难解决方法(0)

如何获得wordpress/woocommerce中的所有订单详情?

我正在使用woo-commerce并试图从数据库中获取所有订单详细信息.我是新手并且无法实现它order_details.php.我已经创建了模板,我可以获取所有订单数据.

谁能帮我吗?

php wordpress wordpress-theming wordpress-plugin woocommerce

2
推荐指数
3
解决办法
2万
查看次数

PHP 从今天开始计算 Google 调查选择加入代码的天数

感谢任何可以提供帮助的人。我正在尝试使用 PHP 从任何给定的当前日期获得 X 天的交货日期。这是与 WordPress 中的 Google 调查选择加入代码和 WooCommerce 一起使用的。

参考此线程:WooCommerce 填写 Google 调查选择加入代码的字段

谷歌想要动态值,解释在这里:https : //support.google.com/merchants/answer/7106244?hl=en&ref_topic=7105160#example

我已经准备好了大部分代码,但是这个动态日期很难弄清楚。

我认为最简单的解决方案是在产品订单的当天添加几天,这可能发生在任何一天。

我的问题是:如何让 PHP 在这种情况下计算它?

我的理解是有 DateTime 和 strtotime,但 DateTime 是最近和“正确”的方式来做到这一点?

这是我到目前为止所得到的,但我不确定它是否正确:

    //Google Survey code 
function wh_CustomReadOrder($order_id) {
    //getting order object
    $order = wc_get_order($order_id);
    $email = $order->billing_email;
    ?>
    <script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script>
    <script>
        window.renderOptIn = function () {
            window.gapi.load('surveyoptin', function () {
                window.gapi.surveyoptin.render(
                        {
                            "merchant_id": [merchant id],
                            "order_id": "<?php echo $order_id; ?>",
                            "email": "<?php echo $email; ?>",
                            "delivery_country": "CA",
                            "estimated_delivery_date": …
Run Code Online (Sandbox Code Playgroud)

php wordpress future date woocommerce

2
推荐指数
1
解决办法
197
查看次数

在 Woocommerce 3 中获取并传递订单商品和订单详细信息

我们需要传递以下 WooCommerce 参数,但我们不能并且出现错误。

  • 唯一订单ID
  • 购买的产品 SKU
  • 每种产品购买的数量
  • 购买的每种产品的价格
  • 交易币种
  • 折扣金额(整个订单和特定商品)
  • 使用的优惠券代码

主要问题是获取所有产品数量、购买的每种产品的数量、产品 SKU

这是我们的代码:

add_action( 'woocommerce_thankyou', 'the_tracking' );

function the_tracking( $order_id ) {

    global  $woocommerce;

    $order = wc_get_order( $order_id );
    $total = $order->get_total();
    $currency = get_woocommerce_currency();
    $subtotal = $woocommerce->cart->subtotal;
    $coupons = $order->get_used_coupons();
    $coupon_code = '';
    $discount = $order->get_total_discount();
    foreach ($coupons as $coupon){
        $coupon_code = $coupon;
    }
    $tracking = 'OrderID='.$order.'&ITEMx=[ItemSku]&AMTx=[AmountofItem]&QTYx=[Quantity]&CID=1529328&OID=[OID]&TYPE=385769&AMOUNT='. $total .'&DISCOUNT='. $discount .'&CURRENCY='. $currency .'&COUPON='. $coupon_code .'';
    echo $tracking;
 }
Run Code Online (Sandbox Code Playgroud)

但它并没有给我们带来我们应该需要的预期结果。

任何帮助表示赞赏。

php wordpress orders woocommerce hook-woocommerce

1
推荐指数
1
解决办法
3059
查看次数

如何在页面上查询Woocommerce订单

我想创建一个页面,该页面显示来自数据库的查询以显示一些订单详细信息。

如何在页面上显示此查询?

php mysql wordpress orders woocommerce

1
推荐指数
1
解决办法
3113
查看次数

获取 Woocommerce 中的订单商品名称

所以我有一个变量,如果我使用var_dump该变量,我会得到一个大数组。我正在尝试获得以下内容:

["name"]=> string(26) "Online marketing Duitsland" 
Run Code Online (Sandbox Code Playgroud)

整个数组结果如下所示:

array(1) { 
  [33]=> object(WC_Order_Item_Product)#9730 (11) { 
    ["extra_data":protected]=> array(9) { 
      ["product_id"]=> int(0) 
      ["variation_id"]=> int(0) 
      ["quantity"]=> int(1) 
      ["tax_class"]=> string(0) "" 
      ["subtotal"]=> int(0) 
      ["subtotal_tax"]=> int(0) 
      ["total"]=> int(0) 
      ["total_tax"]=> int(0) 
      ["taxes"]=> array(2) { 
        ["subtotal"]=> array(0) { } 
        ["total"]=> array(0) { } 
      } 
    } 
    ["data":protected]=> array(11) { 
      ["order_id"]=> int(12291) 
      ["name"]=> string(26) "Online marketing Duitsland" 
      ["product_id"]=> int(11927) 
      ["variation_id"]=> int(0) 
      ["quantity"]=> int(1) 
      ["tax_class"]=> string(0) "" 
      ["subtotal"]=> string(4) "3700" 
      ["subtotal_tax"]=> string(1) "0" 
      ["total"]=> string(4) "3700" 
      ["total_tax"]=> string(1) "0" 
      ["taxes"]=> …
Run Code Online (Sandbox Code Playgroud)

php orders woocommerce

1
推荐指数
1
解决办法
6556
查看次数

如何在 Woocommerce 中获取和显示 BACS 帐户详细信息

我有一个非常简单的想法,但我不知道如何在 WooCommerce 中实现。

在我的商店中,我启用了一些付款方式,也通过银行转帐付款。但是当客户选择银行转账时,他会看到进行转账所需的数据。但在那之后,没有选项可以在感谢页面上显示该数据,每个人都在那里寻找。

有没有一种简单的方法可以再次显示该数据?

php wordpress payment-gateway orders woocommerce

1
推荐指数
1
解决办法
7273
查看次数