Using hooks/filters to customize MarketPress

Would like to make some edit to MarketPress templates, and possibly hooking into the existing functionalities to add my custom one.

Is there any hooks/filters or method I could use to avoid making change in the plugin core files?

  • Konstantinos Xenos

    Hi mike ,

    Unfortunately there's no API documentation at the moment so this would require some searching & testing.

    In any case there are plenty of actions/filters within the files used for you to hook into but it again depends on what you're trying to achieve as an end result.

    As a simple example to hook into the price tag of the front end you'd find the "mp_product/display_price" filter in includes\common\class-mp-product.php .

    add_filter( 'mp_product/display_price', 'change_price_html', 10, 3 );
    function change_price_html( $snippet, $price, $id ) {
    	error_log( $snippet );
    	error_log( print_r( $price, true ) );
    	error_log( $id );
    	echo $snippet;
    };

    Tell us what you'd like to achieve so we could give you some help with possible actions/filters that you could use.

    Regards,
    Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.