Get the Product description from WooCommerce?
10,963
Solution 1
You can have that in cart object items, when getting an instance of the WP_post object, this way:
foreach(WC()->cart->get_cart() as $cart_item){
// Get an instance of Product WP_Post object
$post_obj = get_post( $cart_item['product_id'] );
// HERE the product description
$product_desciption = $post_obj->post_content;
// The product short description
$product_short_desciption = $post_obj->post_excerpt;
}
Solution 2
WooCommerce: Adding the Product Short Description to Archive Pages or Show Products Short Description on Shop Page
function vitahc_excerpt_in_product_archives() {
the_excerpt();
}
add_action('woocommerce_after_shop_loop_item_title','vitahc_excerpt_in_product_archives', 10);
Related videos on Youtube
Author by
carlhandy
Updated on June 04, 2022Comments
-
carlhandy almost 2 years
I built a custom payment gateway extension for woocommerce and I'm posting all the data (item name, cost, quantity etc) in JSON format back to the payment provider.
However, I can't seem to get the item description to go through.
Any ideas?