douben7493 2017-05-22 16:47
浏览 42

移动产品变体而不添加到购物车按钮到侧边栏

I'm trying to move the product variations from woocommerce_single_variation (single-product/add-to-cart/variable.php) to Genesis Sidebar, but i want to keep the Add to Cart button in woocommerce_single_product_summary. I tried at first to move only variations like this:

remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation', 10 );
add_action('genesis_sidebar','woocommerce_single_variation', 5 );

but didn't work. So i moved the entire variations block to sidebar:

/* Remove variations and add to cart button */
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
add_action('genesis_sidebar','woocommerce_template_single_add_to_cart', 5 );

and added back the add to cart button to the product summary:

remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 );
add_action('woocommerce_single_product_summary','woocommerce_single_variation_add_to_cart_button', 5 );

My problem now is that the add to cart button is not working anymore, so I need to simulate the add to cart action. I tried this answer but is not working: Woocommerce - Move add to cart button variable product

Any other solution is welcome, Thank you!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度