我有一个用PHP编写的简单后端管理工具,它从WooCommerce数据库中提取订单并将它们呈现给我们的厨房用于处理交付.
我一直能够突出显示一个表行,该表行的状态不是'wc-completed'处理可能需要的任何其他处理.但是,今天我注意到已经为一个项目退还了一项特定订单.一个部分退款不会更改订单状态,所以我需要拉从另一个数据库表中的退款信息.
我检查了所有我知道的相关的表格,订单处理- ,,wp_posts 和,但没有任何退款信息的迹象.实际上,最后一个表中包含的itemmeta甚至没有调整数量,这使我的报告对于这样的部分订单不正确.wp_postmetawp_woocommerce_order_itemswp_woocommerce_order_itemmeta
当您在woocommerce后端查看订单摘要时,它会显示1此特定项目的数量,然后是其-1下方的数量.我假设基于此,数据库中的某个地方有与订单相关的退款记录,但我似乎无法找到它.即使订单总额中wp_postmeta也没有反映部分退款.
有谁知道这个退款数据存储在wordpress数据库中的哪个位置?
谢谢.
以下代码允许特定产品免费送货:
function wcs_my_free_shipping( $is_available ) {
global $woocommerce;
// set the product ids that are eligible
$eligible = array( '360' );
// get cart contents
$cart_items = $woocommerce->cart->get_cart();
// loop through the items looking for one in the eligible array
foreach ( $cart_items as $key => $item ) {
if( in_array( $item['product_id'], $eligible ) ) {
return true;
}
}
// nothing found return the default value
return $is_available;
}
add_filter( 'woocommerce_shipping_free_shipping_is_available', 'wcs_my_free_shipping', 20 );
Run Code Online (Sandbox Code Playgroud)
我想做的是允许免费送货不是产品,而是送货地址中的特定街道和邮政编码组合.我发现如何为登录用户检查这个,但似乎无法在结帐时找到具有此信息的正确变量.任何帮助将不胜感激.
提前谢谢,-Ben