WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Ultra Simple Paypal Shopping Cart
[resolved] Add to Cart button with variation in theme fil (6 posts)

  1. B1gJ4k3
    Member
    Posted 1 year ago #

    Love this plugin! It's already saved my bacon on a new site I'm working on.

    Curious as to how I can add an Add to Cart button with variations in my theme files, though?

    I would have though I could just do this:

    <?php echo do_shortcode("[wp_cart:Product Name:price:150:var1[Color|Black|Granite|Rust]:end]"); ?>

    but for some reason, that doesn't work?

    Basically just looking for something like this:

    <?php echo print_wp_cart_button_for_product('PRODUCT-NAME', PRODUCT-PRICE); ?>

    with the ability to add variations... Any suggestions? Thanks again!

    http://wordpress.org/extend/plugins/wp-ultra-simple-paypal-shopping-cart/

  2. Mike Castro Demaria
    Member
    Plugin Author

    Posted 1 year ago #

    Hello B1gJ4k3,

    The template code is currently limited, I need to improve it to do the same possibilities than the sort code.

    Use feature request from the support forum, and you will be warn when it will be done : http://www.ultra-prod.com/developpement-support/

    Cheers,
    Mike

  3. B1gJ4k3
    Member
    Posted 1 year ago #

    Thanks for getting back to me Mike. I actually ended up figuring this out a different way. Here's the code in case any one else has a similar question. It seems to work:

    <?php if( get_field('the_price') ) {
    	$price = get_field('the_price');
    	echo '<div id="price">$' . $price . '</div>';
    } ?>
    
    <?php if( get_field('the_colors') ) {
    	$colors = implode('|', get_field('the_colors'));
    
    <?php $title = get_the_title(); ?>
    
    <?php
    if ( function_exists('print_wp_cart_button_for_product') && $price && $colors) {
    	echo apply_filters( 'the_content', '[wp_cart:' . $title . ':price:' . $price . ':var1[Color|' . $colors .']:end]' );
    } ?>
  4. Mike Castro Demaria
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for the trick .

    I add it to Ultra-Prod support forum. It show me the way to improve simply this feature.

    Thanks for your feedback.
    Mike

  5. PinkishHue
    Member
    Posted 1 year ago #

    Could this be used to let the customer add some custom text (or in my case a date from a text field) as a variable? So instead of a dropdown there is a text input?

    I've been testing for a while but can't figure it out.

    Or is there a way I can just append some text to the title?

    Thanks for any help anyone can suggest :)

    p.s. Just realised I have kind of asked 2 questions here so I have copied the 2nd part of my question to a separate thread:

    Re: appending text to title from form input:

    http://wordpress.org/support/topic/append-text-from-input-to-product-title?replies=1#post-3649592

  6. Mike Castro Demaria
    Member
    Plugin Author

    Posted 1 year ago #

    HI PinkishHue,

    Please add feature request on ultra-prod.com forum. I'm using it each time I do an update as to do list.

    Cheers,
    Mike

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.