1
私はWooCommerceで動作するプラグインを開発しており、チェックアウトページで注文を送信した直後にカスタム価格を更新する必要があります。カスタム価格wooocommerceを更新する
質問:可能ですか?
header('Location: http://myweb.com/?add-to-cart=477');
// define the woocommerce_review_order_after_submit callback
function action_woocommerce_review_order_after_submit() {
$custom_price = 10; // This will be your custome price
$target_product_id = 477;
foreach ($cart_object->cart_contents as $value) {
if ($value['product_id'] == $target_product_id) {
$value['data']->price = $custom_price;
}
}
}
// add the action
add_action('woocommerce_review_order_after_submit',
'action_woocommerce_review_order_after_submit');
ありがとう:
私は試してみました。
が重複する可能性をカスタム価格でカートに追加](http://stackoverflow.com/questions/32361369/woocommerce-add-to-cart-with-custom-price) – helgatheviking
これはうまくいきましたか?それが働いたら私の答えを選んでください – Skatox