2017-12-30 34 views
-4

代引き決済ができない商品を掲載しています。その商品のオンライン支払いが必要なので、woocommerceのような特定の商品にオンライン決済方法を指定する方法私は、配送方法で現金を無効にして有効にする方法を知っているが、それはすべての製品のために無効になり、私はwoocommerceの特定の商品の代金引換方法を無効にする方法

は、誰もが、私は一つだけを指定することができますどのようにこの問題を解決することができますことを望んでいないオンライン

をサービスを提供その商品のオンライン決済方法となるお支払い方法

答えて

0

私はこれを知っている2つの方法です。まず、あなたのテーマにfunctions.phpを追加することによって、この素晴らしい機能をBusiness Bloomer - Rodolfo Melogliで使用します。ヘルプが必要な場合は、https://businessbloomer.com/woocommerce-disable-payment-method-for-specific-category/にアクセスして指示に従ってください。

/** 
* @snippet  Disable Payment Method for Specific Category 
* @how-to  Watch tutorial @ https://businessbloomer.com/?p=19055 
* @sourcecode https://businessbloomer.com/?p=19892 
* @author  Rodolfo Melogli 
* @testedwith WooCommerce 3.2.5 
*/ 

add_filter('woocommerce_available_payment_gateways', 'bbloomer_unset_gateway_by_category'); 

function bbloomer_unset_gateway_by_category($available_gateways) { 
global $woocommerce; 
$unset = false; 
$category_ids = array(8, 37); 
foreach ($woocommerce->cart->cart_contents as $key => $values) { 
    $terms = get_the_terms($values['product_id'], 'product_cat');  
    foreach ($terms as $term) {   
     if (in_array($term->term_id, $category_ids)) { 
      $unset = true; 
      break; 
     } 
    } 
} 
    if ($unset == true) unset($available_gateways['cheque']); 
    return $available_gateways; 
} 

第二の方法は、https://wordpress.org/plugins/conditional-payment-methods-for-woocommerce/として、プラグインを使用することです。利用可能なプラグインはいくつかあり、無料であれば有料のものもあります。彼らがしばしばあなたが望むよりもはるかに多くのことをしているので、最初にそれらを研究するのが最善です。

+0

お返事ありがとうございます。私はあなたの手順を踏んで、いつか動作するかどうかを教えてください –

+0

https://businessbloomer.com/woocommerce-disable-payment-method-for-specific-categoryの手順に従ってください/。彼らはそれを書くための広告収入が必要です。私は以前の研究に合格しました。がんばろう。 – Darren

+0

これは、Woocommerceをカスタマイズするための素晴らしいリソースです。 – Darren

関連する問題