私は多くの質問と回答を読みましたが、特にこの「+/- プラスとマイナスの数量ボタンを woocommerce で 12 ずつ増加させる」で、woocommerce 2.0.10 では別の方法でコーディングされているようです。 Ewout によって提案された 1 を 12 で変更する場所がわかりません。私はjsを知りませんが、特定の指示に従うことができます。私は WooCommerce プラグインに VarkTech Minimum Purchase を使用しており、2 つのルールで 3 つの要件のうち 2 つを解決しました。1つはアイテムごとの最小購入数が16で、もう1つは購入した製品の合計で最小注文数が48でしたが、最後の要件は、マイナス/プラスボタンの増分が8である必要があることです. Ewout が Artmart に与えた答えを誰かがもう少し説明してくれれば、非常に助かります。私の英語でごめんなさい。チリからよろしく、
2330 次
2 に答える
1
私の以前のコメントを拡張すると、WooCommerce 2.1 では、ステップ値を直接フィルタリングできます。これをサイト固有のプラグインに入れます。
add_filter( 'woocommerce_quantity_input_step', 'kia_quantity_input_step', 10, 2 );
function kia_quantity_input_step( $step, $product ){
return 6; // the will be the new step value
}
add_filter( 'woocommerce_quantity_input_min', 'kia_quantity_input_min', 10, 2 );
function kia_quantity_input_step( $min, $product ){
return 16; // the will be the new min value
}
于 2014-08-12T13:54:08.263 に答える
0
次のコードを任意のプラグインの任意の php ファイルに配置し、プラグインがアクティブ モードであることを確認します。これは、希望どおりに動作するはずです。コード内のコメントを読んで、要件に応じて値を変更します
add_action( 'init', 'add_filter_to_overwrite_increment' );
function add_filter_to_overwrite_increment() {
add_filter( 'woocommerce_quantity_input_args', 'overwrite_woocommerce_quantity_input_args', 10, 2 );
}
function overwrite_woocommerce_quantity_input_args( $args, $product ) {
$args['input_value'] = 8; // Starting quantity value
$args['max_value'] = 100; // Quantity can not go beyond this value
$args['min_value'] = 1; // Quantity cannot go below this value
$args['step'] = 8; // Value with which you want to increment or decrement
return $args;
}
これが役立つことを願っています。
于 2013-07-20T12:20:45.997 に答える