classMainextendsBridge
{ /** Display Price and Tax */
$this->add_filter(
‘woocommerce_get_sections_tax’,
‘WooComInfusionSettingTax@showTab’
);
$this->add_filter(
‘woocommerce_get_settings_tax’,
‘WooComInfusionSettingTax@showForm’,
10,
2
);
…..
}classWooComInfusionSettingTaxextendsController
{
const SECTION_ID = ‘wc_dispaly_price_tax’;
const SECTION_NAME = ‘Display Inc/Exc Price,Tax’;
/**
* @since 1.0.2
*
*
* @return
*/
publicfunctionshowTab($sections)
{
$sections[self::SECTION_ID] = self::SECTION_NAME;
return$sections;
}
/**
* @since 1.0.2
*
*
* @return
*/
publicfunctionshowForm($settings, $current_section)
{
if($current_section != self::SECTION_ID)
{
return$settings;
}
$settings[] = [
‘id’ => self::SECTION_ID,
‘name’ => ‘Display Price,Tax’,
‘type’ => ‘title’,
‘desc’ => ‘Settings display price and tax according to user.’,
];
$settings[] = [
‘id’ => self::SECTION_ID . ‘_select_scenarios’,
‘name’ => ‘Show Scenario’,
‘type’ => ‘select’,
‘desc’ => __( ‘Set #1,2 in “Tax > Tax options” and in order to use #3, it must be excluded tax in “Tax options(Display prices)” ‘, ‘woocommerce’ ),
‘desc_tip’ => true,
‘options’ => array(
” =>’1,2.Show GST inc or exc (guest +loged in)’,
‘scenario_3′ =>’3.Show GST inc pricing to guest, show GST exc pricing to logged in users’,
),
];
$settings[] = [
‘id’ => self::SECTION_ID . ‘_suffix_inc_gst’,
‘name’ => ‘Price display include GST’,
‘type’ => ‘text’,
‘desc’ => __( ‘It only affects the “show scenario 3” ‘, ‘woocommerce’ ),
‘desc_tip’ => true,
‘css’ => ‘min-width:300px;’,
];
$settings[] = [
‘id’ => self::SECTION_ID . ‘_suffix_exc_gst’,
‘name’ => ‘Price display exclude GST’,
‘type’ => ‘text’,
‘desc’ => __( ‘It only affects the “show scenario 3” ‘, ‘woocommerce’ ),
‘desc_tip’ => true,
‘css’ => ‘min-width:300px;’,
];
// Price display suffix
$settings[] = [
‘type’ => ‘sectionend’,
‘id’ => self::SECTION_ID,
];
return$settings;
}
}