wppizza / markup / cart

The main cart using shortcode [wppizza type='cart'] or the widget available from Appearance -> Widgets -> Wppizza -> Widget Type='Cart'

For shortcode attributes please refer to the shortcode section

CSS Targeting

  • Wrapper div element class: wppizza-cart (used by all instances of widget)
    Wrapper div element class: wppizza-cart-nocache (used by instances of widget if cart loaded via ajax)

if you simply want to edit some styles/layout (text-sizes, color, margins, paddings etc etc ) it is strongly recommended to use css instead of filters/actions. Please refer to Modify Styles/Layout

Filters available

apply filters by adding them to your child-theme’s functions.php (notes regarding functions.php).
many display options are also available by simply using the relevant shortcode attributes instead of filters

  • filter name: wppizza_filter_cart_outer_markup
    purpose: modify the html markup of the html as required

    @param: $markup array (array of markup elements)
    @param: $atts array (attributes)
    @param: $id int (unique id for each instance)
    @return: array

  • Note: the cart itself is made up of modules with opening hours added before (if enabled in widget/shortcode), pickup choice selection after (if pickup enabled) and orderinfo (discounts, charges) at end (if enabled).
    Therefore , the visible structure will be something like this:

     <div> .wppizza-opening-hours </div> # opening times - if enabled
    
     <div> .wppizza-cart # wrapper div - filled with below cart info - dynamically
    
    	 <div> .wppizza-cart-info </div> # cart container div - has it's own filter and uses other template files!
    
     </div> # end wrapper div
    
     <div> .wppizza-orders-pickup-choice </div> # pickup/delivery choice checkbox/radio - if enabled
    
     <div> .wppizza-orders-info </div> # order info - if enabled
    
  • filter examples:

    
    
    add_filter('wppizza_filter_cart_outer_markup', 'prefix_filter_cart_outer_markup', 10, 3);
    function prefix_filter_totals_widget_markup($markup, $atts, $id){
    
    	/* 
    		notes: 
    		use print_r($markup) to view array keys with their respective markup
    		use print_r($atts) to view attributes
    		use print_r($id) to view id of cart instance
    		use global $wppizza_options; to access all options/settings/localization strings etc set in the plugin 
    	*/
    
    	/* example: adding a paragraph AFTER cart container div element using standard php concatenation */
    	$markup['_div'] .= '<p>more text after div</p>'; 
    
    	/* example: adding a paragraph BEFORE cart container div element  using standard php concatenation */
    	$markup['div_'] = '<p>more text before div</p>' . $markup['div_']; 
    
    	/* example: adding a paragraph AFTER cart container div element using wppizza array_splice helper function */
    	$splice_after['myprefix_paragraph'] = '<p>more text after div</p>'; 
    	$markup = wppizza_array_splice($markup, $splice_after, '_div' );
    
    	/* example: adding a paragraph BEFORE cart container div element  using wppizza array_splice helper function */
    	$splice_before['myprefix_paragraph'] = '<p>more text buttons div</p>'; 	
    	$markup = wppizza_array_splice($markup, $splice_before, 'div_' , true);
    
    
    	/* example: using actions of another plugin that by default outputs html to add it after the container wrapper div */
    	ob_start(); # start buffering
    	do_action('other_plugin_output'); # run action of other plugin that outputs things
    	$buffer= ob_get_contents(); # capture buffer in variable
    	ob_end_clean(); # clean buffer			
    	$markup['_div'] = $markup['_div'] . $buffer; # add buffered output after end of wrapper
    
    return $markup;
    }
    		

Actions available

  • none

Editing files directly

ensure you have also read the Modify/Edit Templates

basepath: [plugin-path]/wppizza/templates/markup

filepath: [plugin-path]/wppizza/classes/markup/maincart.php – Not a template/editable file

Modules used in file

  • [basepath]/global/openingtimes.php
  • [basepath]/global/orderinfo.php
  • [basepath]/cart/cart.container.php (has it’s own filter, uses other modules/files)
  • [basepath]/global/pickup_choice.php

Module used by file(s)

  • None