Title: Shortcode for custom list
Last modified: June 12, 2024

---

# Shortcode for custom list

 *  Resolved [matppp](https://wordpress.org/support/users/matppp/)
 * (@matppp)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/shortcode-for-custom-list/)
 * Hi, is there any shortcode to display Wishlist button in custom list? For example,
   I have ACF Post Object and I want to add Wishlist button after Add to cart.
 *     ```wp-block-code
       <?php $items = get_field('items');            if( $items ):                echo '<ul class="products products-slide-mobile c-100">';                foreach( $items as $product_id ):                    $product = wc_get_product( $product_id );                    if( $product ):                        echo '<li class="product" data-aos="fade-up" data-aos-duration="1100">';                        echo '<a href="' . get_permalink( $product->get_id() ) . '">';                        echo wp_get_attachment_image( $product->get_image_id(), 'medium_large' );                        echo '</a>';                        if ($product->is_on_sale()) {                            echo '<span class="onsale">' . __('Sale!', 'woocommerce') . '</span>';                        }                        echo '<h2 class="woocommerce-loop-product__title"><a href="' . get_permalink( $product->get_id() ) . '">' . $product->get_name() . '</a></h2>';                        echo '<span class="price">' . $product->get_price_html() . '</span>';                        echo woocommerce_template_loop_add_to_cart();HOW TO ADD HERE WISHLIST BUTTON?                        echo '</li>';                    endif;                endforeach;                echo '</ul>';            endif;            ?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [rzepsen](https://wordpress.org/support/users/rzepsen/)
 * (@rzepsen)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/shortcode-for-custom-list/#post-17819869)
 * Hi [matppp](https://wordpress.org/support/users/matppp/) 
 * Thank you for feedback. This could work. You would need to have the same HTML
   in the code as there is for the button. You can check in templates/shop-loop/
   add-to-cart-left.php but the minimum HTML for such a button to work is:
 * `<a href="#add-to-wishlist" class="fw-button fw-button--before fw-button--active"
   data-product-id="echo esc_attr( $product->get_id() ); ?>"><span class="fw-button-
   icon></span></a>`
 * If you apply this code, it should work.
 * Feel free to contact me if you have more questions.
 *  Plugin Support [rzepsen](https://wordpress.org/support/users/rzepsen/)
 * (@rzepsen)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/shortcode-for-custom-list/#post-17838777)
 * Hi [matppp](https://wordpress.org/support/users/matppp/) 
 * As we haven’t got any replies, I’m marking this topic as resolved for now.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Shortcode for custom list’ is closed to new replies.

 * ![](https://ps.w.org/flexible-wishlist/assets/icon-256x256.png?rev=2715970)
 * [Flexible Wishlist for WooCommerce - Ecommerce Wishlist & Save for later](https://wordpress.org/plugins/flexible-wishlist/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/flexible-wishlist/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/flexible-wishlist/)
 * [Active Topics](https://wordpress.org/support/plugin/flexible-wishlist/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/flexible-wishlist/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/flexible-wishlist/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [rzepsen](https://wordpress.org/support/users/rzepsen/)
 * Last activity: [1 year, 11 months ago](https://wordpress.org/support/topic/shortcode-for-custom-list/#post-17838777)
 * Status: resolved