Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Can’t you just use flat rate and set the cost per order and “any class” to £0, then add your class with the extra charge?

    I’m having exactly the same issue and can’t find any information regarding it.
    WooCommerce version: 1.6.6
    WordPress version: 3.5
    PHP Version: 5.2.17

    Edit: I’m not using GoDaddy

    The code I supplied in my previous post is used to output a specific widget in a template file, in this case the Dropdown Cart Widget.

    You can do this in two ways (that I am aware of):

    1. Use the code I posted earlier, just put it wherever you want it to be.

    2. Register a widget area in your functions.php and place a code snippet where you want to show it. Then go to Appearance -> Widgets and drag-and-drop the Dropdown Cart Widget to the widget area you just created.

    You can read more about widgets under:
    WordPress Widgets
    Widgetizing Themes

    The following code is taken from “Widgetizing themes” and slightly edited. Put this code into your functions.php file.

    function arphabet_widgets_init() {
    
    	register_sidebar( array(
    		'name' => 'Woocommerce Dropdown Cart',
    		'id' => 'wc_dropdown_cart',
    		'before_widget' => '',
    		'after_widget' => '',
    		'before_title' => '',
    		'after_title' => '',
    	) );
    }
    add_action( 'widgets_init', 'arphabet_widgets_init' );

    Then put the following code wherever you want the dropdown cart to shop up. Maybe in header.php?

    <?php
    	if ( dynamic_sidebar('wc_dropdown_cart') ) :
    	else : ?>
    <?php endif; ?>

    Remember that you have to activate the widget under Appearance -> Widgets.

    Hi

    I was looking for the same thing and found the following in another thread about outputting widgets in template files:

    <?php
    	$instance = array("title" => "", "number" => 1);
    	$args = array("title" => "My Widget", "before_title" => "", "after_title" => "");
    	$sb = new WooCommerce_Widget_DropdownCart();
    	$sb->number = $instance['number'];
    	$sb->widget($args,$instance);
    ?>

    This works for me! You can fill the title, before_title and after_title if you wish. Like:

    $instance = array("title" => "MyTitle", "number" => 1);
    $args = array("title" => "My Widget", "before_title" => "<h2>", "after_title" => "</h2>");

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