function woo_products( $atts ) {
global $post;
$product_Out="";
$atts = shortcode_atts(
array(
'product_ids' => '',// your product id goes here
), $atts, 'bartag' );
$pro_ids = explode(",", $atts['product_ids']);
foreach ($pro_ids as $key => $values) {
$product_obj = $product = wc_get_product( $values );
//call your html and data in $product out variable
$product_Out .= '<div class="product_name">'.$values.'</div>';
}
return $product_Out;
}
add_shortcode( 'woo_products', 'woo_products' );
//use this shortcode [woo_products product_ids="9,86"]
Related Posts:
- Error do_shortcode In WooCommerce Template
- Order Woocommerce Products by Latest Reviewed
- Pagination for a page created by the shortcode “Product”
- How to fix transparency in product sliders / featured products on home page?
- tinymce custom button
- Woocommerce Filter Main Loop by Tag [closed]
- How to not show shortcode contents if cart is empty?
- woocommerce Product shortcode create [closed]
- Shortcode outputs at the top of the_content
- Combining shortcode and get_template_part
- Escaping quotes from shortcode attributes
- Shortcode output always showing at top of page
- How to detect if a Shortcode is being called on a page?
- How to get current page title inside a page itself in a shortcode and in page content
- Short code to display a loop
- shortcode inside another shortcode
- Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]
- Custom Shortcode AJAX 400 Bad Request
- WordPress core responsive video not working with shortcode
- WordPress gallery ‘post_gallery’ filter doesn’t work with feeds?
- shortcode to create dynamic dropdown box form shortcode attributes
- conditional shortcode not working
- How do I add my own custom shortcodes?
- Can’t seem to get [shortcode]s to work
- Wraping $content into link with shortcodes
- nested Shortcode doesn’t work
- Slow page loading when using a simple shortcode on the same page multiple times
- TinyMCE get selected text and underlying HTML
- Remove and restore one shortcode
- Rewriting WordPress Gallery Shortcode with Bootstrap Carousel
- other shortcodes in Contact form 7 MAILS [closed]
- Remove empty p-Tags in Shortcode content before non p-Tags
- What is a short code?
- Display content from another site page using a shortcode
- Wrap shortcode inside custom block
- Instagram URL is converted into oEmbed
- Shortcode with no attribute but has value
- Creating a shortcode based on users preferences
- Get a post’s thumbnail url or display default image in shortcode
- basic shortcode – Why 1st paragraph not wrapped in p tag, but 2nd is
- unwanted P tags in shortcode, delay wpautop not working
- Shortcodes and a list of IDs?
- Convert HTML Script to Shortcode [closed]
- Registration Form Shortcode
- Include tags in the body of a post
- no content after shortcode
- How can I custom order the product display?
- Remove shortcodes that are different (but same pattern) in each post
- Place a URL parameter value inside a WordPress short code
- Scripts for shortcode: concatenate or load separately? [closed]
- Print shortcode in defined area
- WordPress shortcodes are not working
- Conditionally Loading JavaScript/CSS for Shortcodes
- How to use/enable Pagination?
- Wrap Shortcodes and wpautop
- Shortcode called twice
- Favorite websites with shortened hyperlinks
- Best way to find all shortcodes that come with WordPress
- Using Variables in Shortcodes
- Add JS in footer via shortcode?
- Shortcode syntax errors
- Passing variable in nested shortcodes
- Shortcode Always Displays Default Attribute Value
- How to add a same div on every page
- WordPress Shortcode / Only works in classic editor, gutenberg error / invalid json response
- Do shortcode in template file
- How do I fit a function inside an opening and closing do_shortcode
- Pass instance number to shortcode child
- How to make shortcode which returns HTML?
- Add shortcode within the_content()
- Pass a comma separated shortcode attribute to a function
- Enclosing Shortcode not working in a Template
- how to write short code in word press
- hard code shortcode only on specific category
- pass complex json as shortcode parameter
- How to include shortcodes and pdfs in WordPress search without plugin?
- How to embeded shortcode for another website
- Gutenberg Shortcode will turn html to html entity
- Need help in setting up a transient using API Key and if possible updating it in the ACF field
- the_content() not showing the content in good order (with a shortcode)
- Execute shortcode in backend
- in post content shortcode works, but hardcoded in same page template doesn’t?
- Load gravity form via ajax using do_shortcode
- How to Enable embedding WordPress default gallery in comments?
- Print shortcode according to site language
- Remove a short code and update it’s content (AJAX)
- create a shortcode for embedding google map in a page
- How to process a single attribute in a SQL request twice times?
- Customise standard lists within my shortcode
- Timber – don’t display shortcode
- Use ACF array values in shortcode
- Video shortcode outside WordPress not working with IE and mediaelement’s Flash fallback
- Inserting a variable into a shortcode inside php
- Using shortcodes that wrap around code
- Shortcode for Admin Theme Option?
- Clarify: Enqueueing scripts within shortcode only loads in footer?
- What makes a placeholder resizable in Tinymce?
- I have the query code but not the shortcode
- wordpress how to sort posts on custom data with plug-in “Search & Filter”
- How to reuse php templates as shortcodes?