1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.