最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

(Woocommerce) How to add a custom page between cart and checkout with a file upload field per product item in the cart?

programmeradmin2浏览0评论

I am using Woocommerce.

I want to add a custom page in between the cart and checkout page. In this custom page, I want to show a file upload field per product item in the cart. This has to tie into the order page in the admin.

Additionally, I also want to add some HTML depending on the product variation in the cart.

If product variation ID147 is in cart, show HTML "Link for ID147". If product variation ID236 is in cart, show HTML "Link for ID236".

I have somewhat managed to complete the first part which is to add a custom page in between the cart and checkout.

add_action('woocommerce_proceed_to_checkout', 'change_proceed_to_checkout');

function change_proceed_to_checkout() {
    remove_action('woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20);
    add_action('woocommerce_proceed_to_checkout', 'stan_button_proceed_to_upload_artwork_page', 20);
}

function stan_button_proceed_to_upload_artwork_page() {
    $button_name = esc_html__('Custom page step', 'woocommerce');
    $button_link = get_permalink(1636);
    ?>

    <a href="<?php echo $button_link;?>" class="btn">
        <?php echo $button_name; ?>
    </a>
    <?php
}

Any help would be much appreciated.

Thanks.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论