Meta Product name
-
Hi Team,
I hope you are well.
I’m not sure if you can assist with this, but I have a question regarding Stripe and PayPal. Is it possible to hide the product name sent to Stripe and PayPal and replace it with “Payment from [Website link]”?
Can this be achieved through a snippet?
Check the code i wrote below but not working on stripe is showing like “product_2321” and paypal the product name is shwoing as well.
Thank you.
// Remove Stripe Product Title from Stripe Order Meta
function modify_stripe_order_meta_data($meta_data, $order) {
unset($meta_data['partner']);
unset($meta_data['product']);
unset($meta_data['user_id']);
// Add the replacement meta data
$meta_data['description'] = 'Donation';
return $meta_data;
}
add_filter('wc_stripe_order_meta_data', 'modify_stripe_order_meta_data', 10, 2);
// Modify PayPal Product Title from PayPal Order Meta
function modify_paypal_order_meta_data($order) {
$meta_data = $order->get_meta_data();
// Remove specific meta data
unset($meta_data['partner']);
unset($meta_data['product']);
unset($meta_data['user_id']);
// Add the replacement meta data
$meta_data['description'] = 'Donation';
// Set the modified meta data back to the order
$order->set_meta_data($meta_data);
return $order;
}
add_filter('wc_ppcp_order_meta_data', 'modify_paypal_order_meta_data', 10, 1);
// Modify PayPal Item Names
function modify_paypal_item_names($items, $order) {
foreach ($items as $item) {
$item->set_name('Donation');
}
return $items;
}
add_filter('woocommerce_paypal_order_items', 'modify_paypal_item_names', 10, 2);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Meta Product name’ is closed to new replies.