<?php if (! defined('PUSTAKA_THEME_DIR')){define('PUSTAKA_THEME_DIR',get_template_directory())}if (! defined('PUSTAKA_THEME_URI')){define('PUSTAKA_THEME_URI',get_template_directory_uri())}if (! defined('PUSTAKA_THEME_APP_DIR')){define('PUSTAKA_THEME_APP_DIR',PUSTAKA_THEME_DIR . '/app')}if (! defined('PUSTAKA_THEME_APP_URI')){define('PUSTAKA_THEME_APP_URI',PUSTAKA_THEME_URI . '/app')}if (! defined('PUSTAKA_THEME_CORE_DIR')){define('PUSTAKA_THEME_CORE_DIR',PUSTAKA_THEME_DIR . '/bootstrap/core')}if (! defined('PUSTAKA_THEME_CORE_URI')){define('PUSTAKA_THEME_CORE_URI',PUSTAKA_THEME_URI . '/bootstrap/core')}if (! defined('PUSTAKA_THEME_ASSETS_DIR')){define('PUSTAKA_THEME_ASSETS_DIR',PUSTAKA_THEME_URI . '/assets')}if (! defined('PUSTAKA_THEME_ASSETS_URI')){define('PUSTAKA_THEME_ASSETS_URI',PUSTAKA_THEME_URI . '/assets')}if (! defined('PUSTAKA_THEME_VERSION')){define('PUSTAKA_THEME_VERSION','3.0.0')}if (! defined('PUSTAKA_OPTIMIZE_MODE')){define('PUSTAKA_OPTIMIZE_MODE',true)}require_once(PUSTAKA_THEME_DIR . '/bootstrap/class-tgm-plugin-activation.php');require_once(PUSTAKA_THEME_DIR . '/bootstrap/plugins.php');require_once(PUSTAKA_THEME_DIR . '/bootstrap/class-autoloaders.php');require_once(PUSTAKA_THEME_DIR . '/bootstrap/setup.php');require_once(PUSTAKA_THEME_DIR . '/importer/config.php');require_once(PUSTAKA_THEME_DIR . '/importer/after-import.php');remove_action('woocommerce_after_shop_loop_item','woocommerce_template_loop_add_to_cart',10);add_filter('woocommerce_product_single_add_to_cart_text','__return_empty_string');// remove text function add_buy_now_button_shop(){global $product;if (! $product) return;$product_id=$product->get_id();$checkout_url=wc_get_checkout_url(../../../themes/pustaka/) . '?add-to-cart=' . $product_id;echo '<a href="' . esc_url($checkout_url) . '" class="buy-now-button">
        Buy Now
    </a>'}add_action('woocommerce_after_shop_loop_item','add_buy_now_button_shop',15);function custom_product_action_buttons(){global $product;if (! $product) return;$product_id=$product->get_id();$checkout_url=wc_get_checkout_url(../../../themes/pustaka/) . '?add-to-cart=' . $product_id;$cart_url='?add-to-cart=' . $product_id;$price=$product->get_price();$currency=get_woocommerce_currency_symbol();$whatsapp="https://wa.me/9203425548690?text=" . urlencode("Assalam o Alaikum 👋\n\n" . "I want to order this product.\n\n" . "🛍 Product Details:\n" . "Product: " . get_the_title() . "\n" . "Price: " . $currency . " " . $price . "\n\n" . "📍 Please provide your complete delivery address below:\n" . "Name:{Enter your name here }\n" . "City:{Enter your city here }\n" . "Full Address:{Enter your addres here }\n" . "Phone Number:{Enter your Phone number here }\n\n" . "💳 Prepaid Payment Details:\n" . "Bank: Dubai Bank Islami\n" . "Account Title:Emel Publications \n" . "Account Number:PK79DUIB0000000054120002 \n\n" . "After payment, kindly send the payment screenshot or transaction reference for order confirmation.\n\n" . "Thank you for choosing Emel Books");echo '<div class="custom-product-buttons">';// Add to cart echo '<a href="'.$cart_url.'" class="product-action-btn add-cart-btn">
            Add to cart
          </a>';// Buy now echo '<a href="'.$checkout_url.'" class="product-action-btn buy-now-btn">
            Buy it now
          </a>';// WhatsApp echo '<a href="'.$whatsapp.'" target="_blank" class="product-action-btn whatsapp-order-btn">
            Order On WhatsApp
          </a>';echo '</div>'}remove_action('woocommerce_single_product_summary','custom_buy_now_button_single',30);remove_action('woocommerce_single_product_summary','add_whatsapp_next_to_socials',35);add_action('woocommerce_single_product_summary','custom_product_action_buttons',30);function add_whatsapp_next_to_socials(){if (is_product()){$url=urlencode(get_permalink());$title=urlencode(get_the_title());echo '<div class="custom-whatsapp-inline">
            <a class="social-btn whatsapp-btn" href="https://wa.me/?text='.$title.' '.$url.'" target="_blank">
               <i class="fab fa-whatsapp"></i> WhatsApp
            </a>
        </div>'}}add_action('woocommerce_single_product_summary','add_whatsapp_next_to_socials',35);add_filter('woocommerce_add_to_cart_redirect',function(){return wc_get_checkout_url(../../../themes/pustaka/)});function custom_minimal_checkout_fields($fields){$fields['billing']=array('billing_first_name'=>array('label'=>'First Name','required'=>true,'class'=>array('form-row-first'),),'billing_last_name'=>array('label'=>'Last Name','required'=>true,'class'=>array('form-row-last'),),'billing_email'=>array('label'=>'Email','required'=>true,'class'=>array('form-row-wide'),),'billing_phone'=>array('label'=>'Phone','required'=>true,'class'=>array('form-row-wide'),),'billing_city'=>array('label'=>'City','required'=>true,'class'=>array('form-row-wide'),),'billing_address_1'=>array('label'=>'Full Address','required'=>true,'class'=>array('form-row-wide'),),);$fields['shipping']=array();// remove shipping fields return $fields}add_filter('woocommerce_checkout_fields','custom_minimal_checkout_fields');add_action('wp_enqueue_scripts',function (){if (! is_admin()){wp_dequeue_script('zxcvbn');wp_deregister_script('zxcvbn')}},100);function add_payment_icons(){?><div class="checkout-payment-icons" style="margin-top: 10px;"><img src="<?php echo esc_url(../../../themes/pustaka/get_template_directory_uri()); ?>/assets/img/jazzcash.png" alt="JazzCash" style="height:40px; margin-right:10px;"><img src="<?php echo esc_url(../../../themes/pustaka/get_template_directory_uri()); ?>/assets/img/easypaisa.png" alt="Easypaisa" style="height:40px; margin-right:10px;"><img src="<?php echo esc_url(../../../themes/pustaka/get_template_directory_uri()); ?>/assets/img/visa.png" alt="Visa" style="height:40px; margin-right:10px;"></div><?php}add_action('woocommerce_review_order_after_payment','add_payment_icons');