Home Forums WoodMart support forum send cart list without payment

send cart list without payment

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #581274

    mahnaz
    Participant

    Hello,

    I created a button on the checkout page, and I want the system to automatically send a list to the admin when people click this button. I created code for that, but it is not working. Are there any features in your theme that could help with this?

    I will also share the code with you.

    Thanks.

    #581285

    Hello,

    Sorry to say there are no options in theme settings available for that, You need to find a third party plugin to achieve more functionality that best suits you.
    https://wordpress.org/plugins/wc-place-order-without-payment/

    If you have any questions feel free to contact us.

    Best Regards.

    #581291

    mahnaz
    Participant

    Thank you so much
    can we use code for that and add this feature for emaple :
    // Add custom button to the checkout page below the “Place Order” button
    add_action(‘woocommerce_review_order_after_submit’, ‘custom_button_below_place_order’);
    function custom_button_below_place_order() {
    ?>
    <button type=”button” id=”send_to_admin” class=”button alt”>Send to Admin</button>
    <script type=”text/javascript”>
    jQuery(function($) {
    $(‘#send_to_admin’).click(function(e) {
    e.preventDefault();
    $.ajax({
    type: ‘POST’,
    url: wc_checkout_params.ajax_url,
    data: {
    action: ‘send_product_info_to_admin’,
    order_data: $(‘form.checkout’).serialize()
    },
    success: function(response) {
    alert(response);
    }
    });
    });
    });
    </script>
    <?php
    }

    // Handle the AJAX request to send product information to the admin
    add_action(‘wp_ajax_send_product_info_to_admin’, ‘send_product_info_to_admin’);
    add_action(‘wp_ajax_nopriv_send_product_info_to_admin’, ‘send_product_info_to_admin’);

    function send_product_info_to_admin() {
    if (isset($_POST[‘order_data’])) {
    parse_str($_POST[‘order_data’], $order_data);

    // Get product information
    $items = WC()->cart->get_cart();
    $product_info = ”;
    foreach($items as $item => $values) {
    $product = wc_get_product($values[‘data’]->get_id());
    $product_info .= ‘Product: ‘ . $product->get_name() . ‘<br>’;
    $product_info .= ‘Quantity: ‘ . $values[‘quantity’] . ‘<br>’;
    $product_info .= ‘Price: ‘ . $product->get_price() . ‘<br><br>’;
    }

    // Send email to admin
    $to = get_option(‘admin_email’);
    $subject = ‘Product Information from Checkout Page’;
    $message = ‘Customer has sent the following product information:<br><br>’ . $product_info;
    $headers = array(‘Content-Type: text/html; charset=UTF-8’);
    wp_mail($to, $subject, $message, $headers);

    echo ‘Product information sent to admin successfully.’;
    } else {
    echo ‘Failed to send product information.’;
    }

    wp_die();
    }
    and or customer has two option for that
    thanks

    #581415

    Hello,

    Sorry to say it requires customization and beyond our support policy. Additional code customizations are out of our theme support scope.

    Hope you can understand!

    Best Regards.

    #586304

    mahnaz
    Participant

    I used this plugin https://wordpress.org/plugins/wc-place-order-without-payment/ was great, only one question is it possible do something people have another option such as etransfer ?

    #586396

    Hello,

    Please ask the plugin author support about this issue. This is related to the 3rd party plugin not related to the theme.

    Best Regards.

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)