Title: How to change php shortcode
Last modified: August 30, 2016

---

# How to change php shortcode

 *  Resolved [EasySites](https://wordpress.org/support/users/easysites/)
 * (@easysites)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/how-to-change-php-shortcode/)
 * Hi, I thank you for your plugin!
    I am trying to insert it directly inside the
   content-single.php file but without results. I have inserted the code <?php echo
   do_shortcode(‘[wp_cart_button name=”Test Product” price=”29.95″]’); ?> but I 
   would like that the name of the product and the price will be taken automatically,
   without having to insert them manually.
 * Can someone help me with how to modify the code to make it work correctly?
 * Thank You!!
 * [https://wordpress.org/plugins/wordpress-simple-paypal-shopping-cart/](https://wordpress.org/plugins/wordpress-simple-paypal-shopping-cart/)

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

 *  Plugin Contributor [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/how-to-change-php-shortcode/#post-6486282)
 * Hi, try something similar to the following example.
 * `<?php echo print_wp_cart_button_for_product("Product Name","10.00"); ?>`
 * Regards
 *  Plugin Contributor [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/how-to-change-php-shortcode/#post-6486501)
 * Hi is your issue fixed?
 *  Thread Starter [EasySites](https://wordpress.org/support/users/easysites/)
 * (@easysites)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/how-to-change-php-shortcode/#post-6486532)
 * Sorry but no.
    Every post have a title and a price, that in php are the_title();
   and the_price(); I need that the button take automatically those information..
 * Something like this
 * <?php
    echo do_shortcode(‘[wp_cart_button name=”the_title();” price=”the_price();”]’);?
   >
 * but it does not work..
 *  Plugin Contributor [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/how-to-change-php-shortcode/#post-6486533)
 * Hi here is a code someone shared to get the title and some extra features. This
   might provide some help.
 *     ```
       <?php echo do_shortcode(‘[wp_cart_button name=”‘. get_the_title() . ‘ “
                       price=”add your value here’. get_post_meta(get_the_ID(), ‘wpcf-price’, TRUE) . ‘” shipping=”4.99 var1=”Size | small | medium | large”]’); ?>
       ```
   

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

The topic ‘How to change php shortcode’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-simple-paypal-shopping-cart/assets/icon-128x128.
   png?rev=2722490)
 * [Simple Shopping Cart](https://wordpress.org/plugins/wordpress-simple-paypal-shopping-cart/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-simple-paypal-shopping-cart/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-simple-paypal-shopping-cart/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-simple-paypal-shopping-cart/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-simple-paypal-shopping-cart/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-simple-paypal-shopping-cart/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/how-to-change-php-shortcode/#post-6486533)
 * Status: resolved