MaxtDesign

Developer Guide

Product type and class

The bundle product type is registered as md_bundle (label "Bundle"). Bundle products are instances of MaxtDesign\Bundles\Product\WC_Product_Bundle, mapped through the standard woocommerce_product_class filter. The class extends WC_Product, so type checks like $product->get_type() === 'md_bundle' and $product instanceof \MaxtDesign\Bundles\Product\WC_Product_Bundle both work.

The namespaced class and the md_-prefixed type slug are deliberate: they cannot collide with other bundle plugins that use a bare bundle type.

Data storage

  • Bundle composition and pricing live in the _md_bnd_config post meta on the bundle product
  • Display settings live in the md_bnd_display option
  • Imported bundles are marked with _md_bnd_imported_from
  • Treat _md_bnd_config as an internal format and go through the product object where possible; the shape can evolve between versions.

    Actions

    // Fires once the plugin has fully booted.
    do_action( 'md_bnd_loaded' );
    
    // Fires after the Bundle authoring panel renders in the product editor.
    // $post_id (int) and $bundle (the parsed bundle model) are passed.
    do_action( 'md_bnd_panel_after', $post_id, $bundle );

    Filters

    // Change the heading level of the front-end "What's included" heading.
    // Default 2, clamped to 2-6. Return 3 if your theme renders its own h2.
    add_filter( 'md_bnd_heading_level', fn( $level ) => 3 );
    
    // Adjust the DISPLAYED per-item price on the product page, for example
    // to reflect role-based pricing. Display only: this filter can never
    // change what is actually charged, which is always recalculated
    // server-side from real product prices.
    add_filter( 'md_bnd_display_price', function ( $price, $product_id, $container ) {
        return $price;
    }, 10, 3 );

    Asset loading rules

    Front-end assets are gated three ways, and knowing the gates helps when debugging "missing" assets:

  • 1.The stylesheet loads only on a single product page whose product is an enabled, purchasable bundle
  • 2.The quantity script loads only when at least one item quantity is customer-adjustable
  • 3.The lightbox CSS and JS load only when quick view is enabled in Bundle Display and thumbnails are on
  • Nothing loads anywhere else: no admin-ajax polling, no REST calls from the front end, no external requests.

    Uninstall behavior

    Deleting the plugin removes its own data: _md_bnd_config and _md_bnd_imported_from post meta and the md_bnd_display option. Products themselves are never deleted; a former bundle simply becomes a product without bundle data.