WP Ecommerce
WP-Ecommerce – Set Default Country
If the majority of your customers are in the same country in makes sense to make their checkout experience easier by setting the default country appropriately. Add this to your THEME/functions.php file and change the returned country code as required. function zao_default_country( $value ) { remove_filter( ‘wpsc_get_visitor_meta_shippingcountry’, __FUNCTION__, 15 ); $current_value = wpsc_get_customer_meta( ‘shippingcountry’ );…
Read MoreTransaction Results replace Total Shipping with text if $0
This filters the purchase log array to change the output if the shipping cost is $0. Example purchase log $args array to show the elements: // Purchase log $args array example Array ( [purchase_id] => Purchase # 10 [total_tax] => Total Tax: $0.00 [total_shipping] => Total Shipping: $0.00 [total_price] => Total: $5.50 [shop_name] => Jeymar…
Read MoreShopping Cart show text if Total Shipping cost is zero
This changes the Total Shipping item in the shopping cart using existing filters so can go in the themes functions.php file: //cart shipping price filter // filters “Total Shipping” amount in cart function cart_shipping_to_be_determined(){ global $wpsc_cart; $result=($wpsc_cart ->calculate_total_shipping()); if(!$result > 0){ $result =”To be determined”; return $result; } return $result; } add_filter(‘wpsc_cart_shipping’, ‘cart_shipping_to_be_determined’);
Read MoreShopping Cart show text if shipping option cost is zero
The aim was to replace the shipping cost for any shipping option that has a value of $0.00 with some text, in this case “To be determined. We’ll get back to you”. This filter must be used within the shipping options loop in the shopping cart page before the shipping options are printed so immediately…
Read MoreAdd Variation Price to Product Variation Drop Down on Single Product Page
In wpsc-single_product.php find the code that writes the options for the variations drop down. <option value=”<?php echo wpsc_the_variation_id(); ?>” <?php echo wpsc_the_variation_out_of_stock(); ?>><?php echo wpsc_the_variation_name(); ?> </option> The variation price can be displayed using: echo wpsc_the_variation_price(); So add this to the first code sample to display the variation price in the variation drop down as…
Read MoreWP E-Commerce Custom Fields used in Conditional Statements
WP E-Commerce Custom Fields plugin enables custom meta fields to be added to all the products edit page. Install the plugin from here: https://wordpress.org/plugins/wp-e-commerce-custom-fields/ Once installed these custom fields are defined under the Products >> Attributes menu. Create the attribute then assign values in the individual product admin pages. To show the value of the…
Read MoreAssigning Countries to Continents and creating Regions for Shipping Calculations
For continental shipping calculations we can assign countries to specific continents or country groups and create sub regions within a country. Assign Country to Continent Get country ID from wp_wpsc_currency_list table for region creation below In the same table you can assign any country to a continent or country group Create Regions for a Country…
Read MoreListing Sub Categories on Parent Category page in WP_Ecommerce
Here we are trying to show sub categories in a grid when the category page is being viewed In wpsc-products_page.php replace this: <div class=”wpsc_categories wpsc_category_grid group”> <?php wpsc_start_category_query(array(‘category_group’=> get_option(‘wpsc_default_category’), ‘show_thumbnails’=> 1)); ?> <?php wpsc_print_subcategory(“”, “”); ?><a href=”<?php wpsc_print_category_url();?>” class=”wpsc_category_grid_item <?php wpsc_print_category_classes_section(); ?>” title=”<?php wpsc_print_category_name(); ?>”> <?php wpsc_print_category_image(); ?> </a> <?php wpsc_end_category_query(); ?> </div><!–close wpsc_categories–> with…
Read MoreGet Category Slug on Single Product Page
In wpsc_single-product.php: //get cat of product $query_data = Array(); $pr_post_id = wpsc_the_product_id(); $categories = wp_get_object_terms($pr_post_id , ‘wpsc_product_category’ ); //if product is associated with more than one category if(count($categories) > 1 && isset($wpsc_query->query_vars[‘wpsc_product_category’])) $query_data[‘category’] = $wpsc_query->query_vars[‘wpsc_product_category’]; elseif(count($categories) > 0) $query_data[‘category’] = $categories[0]->slug; Then you can use the category slug as follows for example: if($query_data[‘category’] == “t-shirts”){…
Read MoreWP Ecommerce variation out of stock message
When a variation is out of stock WP Ecommerce defaults to saying that the product is out of stock rather than just the variation. There is fork on Git hub covering this at: https://github.com/wp-e-commerce/WP-e-Commerce/pull/495 The fix is as follows: wp-content/plugins/wp-e-commerce/wpsc-includes/ajax.functions.php Around line 100 change as follows: – $cart_messages[] = sprintf( __( ‘Sorry, but the item…
Read More