Title: WP eStore Shortcode Help (PHP required)
Last modified: August 20, 2016

---

# WP eStore Shortcode Help (PHP required)

 *  Resolved [Hazel Z.](https://wordpress.org/support/users/cadencehart/)
 * (@cadencehart)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/wp-estore-shortcode-help-php-required/)
 * Hi! I’m a PHP newbie and I need assistance in modifying WP eStore shortcodes.
 * Most of my posts’ contents are displayed via Custom Fields. Therefore, I need
   to use the shortcodes in theme files. Now the problem is, a product ID needs 
   to be specified for every add to cart button. The original code below is not 
   dynamic so I have to call a custom field in every post that specifies the product
   ID. (Note: I only display one product per page).
 * Code to add in theme is:
    `<?php echo get_button_code_for_product(1); ?>`
 * The More Fields Plugin function to call the product id is
    `<?php meta('id');?
   >`
 * How do I merge these two functions to correctly display the add to cart button?
 * Thank you so much for the help!

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

 *  Thread Starter [Hazel Z.](https://wordpress.org/support/users/cadencehart/)
 * (@cadencehart)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/wp-estore-shortcode-help-php-required/#post-2457152)
 * Found the solution. Here it is:
 *     ```
       <?php $productkey = get_post_meta($post->ID, 'wp-product-id', true); ?>
       <?php echo get_button_code_for_product($productkey); ?>
       ```
   
 *  [Gin](https://wordpress.org/support/users/rawdolphe/)
 * (@rawdolphe)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/wp-estore-shortcode-help-php-required/#post-2457443)
 * Can you elaborate on this one?

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

The topic ‘WP eStore Shortcode Help (PHP required)’ is closed to new replies.

## Tags

 * [Ecommerce](https://wordpress.org/support/topic-tag/ecommerce/)

 * 2 replies
 * 2 participants
 * Last reply from: [Gin](https://wordpress.org/support/users/rawdolphe/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/wp-estore-shortcode-help-php-required/#post-2457443)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
