php - Edit the details of products in Woocommerce Cart and get it exported with "Cart to PDF"
Get the solution ↓↓↓We are using a plugin (WooCommerce Cart PDF By welaunch) for export the cart as PDF https://codecanyon.net/item/woocommerce-cart-pdf/25815990
and we have got a code snippet to insert an ACF (showing there by the name of: Product ACF Entry) into the cart product description and showing in the PDF export of cart
function show_fields($item_data, $cart_item) {
if ($field = get_field('acf_product_cart', $cart_item['product_id']))
$item_data[] = array(
'key' => __( 'About', 'theme' ),
'value' => $field,
'display' => '',
);
if ($field = get_field('product_acf_entry', $cart_item['product_id']))
$item_data[] = array(
'key' => __( 'Product ACF Entry', 'theme' ),
'value' => $field,
'display' => '',
);
return $item_data;
}
add_action('woocommerce_get_item_data','show_fields', 10, 2);
We are looking for the following: -
(1) Products in cart: remove the break between the attribute name and its value for all types of products. And to reduce the distance between the lines (breaks)
(2) To be able to remove the ACF name: full line with its break and colon
The below solution have shown the variable and its value in the same line correctly, but still did not come correctly in the Export Cart to PDF
Display variations attributes values as separate rows in Woocommerce cart / checkout
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: malformed utf-8 characters, possibly incorrectly encoded
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.