if ( ! defined( ‘AX_WA’ ) ) define( ‘AX_WA’, ‘989109011133’ );
if ( ! defined( ‘AX_BALE’ ) ) define( ‘AX_BALE’, ‘https://ble.ir/anbarix’ );
/* 1) بهجای قیمت، متن استعلام */
add_filter( ‘woocommerce_get_price_html’, function () {
return ‘استعلام قیمت لحظهای‘;
}, 100 );
/* 2) غیرفعال کردن خرید و حذف برچسب حراج */
add_filter( ‘woocommerce_is_purchasable’, ‘__return_false’ );
add_filter( ‘woocommerce_sale_flash’, ‘__return_empty_string’ );
/* 3) حذف دکمهی پیشفرض سبد در لیست محصولات */
add_action( ‘wp’, function () {
remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 10 );
} );
/* 4) ساخت دکمههای سفارش */
function ax_order_buttons( $product ) {
if ( ! $product ) return ”;
$msg = ‘سلام، میخوام محصول «’ . $product->get_name() . ‘» رو سفارش بدم’ . “\n” . get_permalink( $product->get_id() );
$wa = ‘https://wa.me/’ . AX_WA . ‘?text=’ . rawurlencode( $msg );
return ‘
‘;
}
add_action( ‘woocommerce_after_shop_loop_item’, function () {
global $product; echo ax_order_buttons( $product );
}, 10 );
add_action( ‘woocommerce_single_product_summary’, function () {
global $product; echo ax_order_buttons( $product );
}, 31 );
/* 5) سبد و تسویهحساب به صفحه اصلی هدایت شوند */
add_action( ‘template_redirect’, function () {
if ( function_exists( ‘is_cart’ ) && ( is_cart() || is_checkout() ) ) {
wp_safe_redirect( home_url( ‘/’ ) );
exit;
}
} );
/* 6) ظاهر (رنگهای انباریکس، موبایل و دسکتاپ) */
add_action( ‘wp_head’, function () { ?>
