• Resolved aliceandcaligula

    (@aliceandcaligula)


    Hi Claudio,

    this is a really nice plugin, thank you very much! As I use a very custom review-order.php table with product images and product description (have a look HERE), I need to add some blank lines in the table. I tried modifying class-wc-payment-discounts.php, but with no success. Could you help me, please?

    This its the relevant part of code (I guess):

    **
    	 * Diplay the discount in checkout order view.
    	 *
    	 * @return string
    	 */
    	public function discount_display() {
    		$woocommerce = self::woocommerce_instance();
    
    		if ( version_compare( $woocommerce->version, '2.1', '>=' ) ) {
    			if ( 0 < $this->cart_discount ) {
    				$html = '<tr class="order-total">';
    
    <--- extra empty <th></th> here --->
    
    					$html .= '<th>' . $this->discount_name . '</th>';
    
    <--- extra empty <th></th> here --->
    <--- extra empty <th></th> here --->
    
    					$html .= '<td>-' . woocommerce_price( $this->cart_discount ) . '</td>';
    				$html .= '</tr>';
    
    				echo $html;
    			}
    		}
    	}

    I’m not good at php, so any help would be appreciated.

    Thank you very much,
    Jana

    https://www.ads-software.com/plugins/woocommerce-payment-discounts/

Viewing 1 replies (of 1 total)
  • Plugin Author Claudio Sanches

    (@claudiosanches)

    In version 2.0.3 you can use the wc_payment_discounts_row filter.

    Example to use with your theme functions.php:

    function custom_wc_payment_discounts_row( $html, $discount_name, $discount_price ) {
        $html = '<tr class="order-total">';
            $html .= '<th></th>';
            $html .= '<th>' . $discount_name . '</th>';
            $html .= '<td></td>';
            $html .= '<td></td>';
            $html .= '<td>-' . $discount_price . '</td>';
        $html .= '</tr>';
    
        return $html;
    }
    
    add_filter( 'wc_payment_discounts_row', 'custom_wc_payment_discounts_row', 1, 3 );
    
Viewing 1 replies (of 1 total)
  • The topic ‘Table’ is closed to new replies.