Home › Forums › WoodMart support forum › send cart list without payment
send cart list without payment
- This topic has 5 replies, 2 voices, and was last updated 4 months, 2 weeks ago by Aizaz Imtiaz Awan.
-
AuthorPosts
-
July 5, 2024 at 3:09 pm #581274
mahnazParticipantHello,
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.
July 5, 2024 at 3:23 pm #581285
Aizaz Imtiaz AwanKeymasterHello,
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.
July 5, 2024 at 3:27 pm #581291
mahnazParticipantThank 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
thanksJuly 6, 2024 at 9:19 am #581415
Aizaz Imtiaz AwanKeymasterHello,
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.
July 28, 2024 at 8:30 pm #586304
mahnazParticipantI 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 ?
July 29, 2024 at 12:29 pm #586396
Aizaz Imtiaz AwanKeymasterHello,
Please ask the plugin author support about this issue. This is related to the 3rd party plugin not related to the theme.
Best Regards.
-
AuthorPosts
Tagged: webhook
- You must be logged in to create new topics. Login / Register