[Plugin: WordPress Simple Paypal Shopping Cart] Custom code question:
-
I’m still pretty noobish when it comes to this stuff but I can’t tell what’s wrong with my code. I’ll try to explain what I’m doing. I put some code in a widget that pulled the_title into the ‘PRODUCT-NAME’ section of the ‘add to cart’ button, and charge $10 for the item. I was pleased with myself. Then I got really crazy and decided I could use get_post_custom_values for the ‘ITEM-PRICE’ code the same way. So I added a custom field called ‘price’, added prices to a couple of items, then tested the button. It displayed this in the sidebar:
Warning: number_format() expects parameter 1 to be double, string given in XXXXXXXXXX/wordpress-simple-paypal-shopping-cart/wp_shopping_cart.php on line 321
The following is my code:
<?php $productid = get_the_title(); $price = get_post_custom_values('Price'); echo print_wp_cart_button_for_product("$productid", "$price"); ?>
I’m doing something silly aren’t I? Please tell me I’m close!
This is one of the posts: https://pins.kevinbyrd.co/vc033008/
The post titles are the product IDs. Right now everything’s ten bucks anyway so that’s just a text string currently, but I’d like to be able to use that variable.
https://www.ads-software.com/extend/plugins/wordpress-simple-paypal-shopping-cart/
- The topic ‘[Plugin: WordPress Simple Paypal Shopping Cart] Custom code question:’ is closed to new replies.