Skip to content
Snippets Groups Projects

Ova Cars for ShopMagic

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Bartek Jaskulski
    Edited
    ovacars-placeholder.php 888 B
    <?php
    /**
     * Plugin Name: Ova Cars for ShopMagic
     */
    
    use WPDesk\ShopMagic\Placeholder\Builtin\WooCommerceOrderBasedPlaceholder;
    
    add_action(
        'shopmagic/core/placeholders',
        static function (array $placeholders) {
            $placeholders[] = new class extends WooCommerceOrderBasedPlaceholder {
                public function get_slug(): string
                {
                    return parent::get_slug() . '.ovacrs_pickup_date';
                }
    
                public function value( array $parameters = null ): string
                {
                    // Are you sure, method `get_order_ovacars_pickup_date` exists?
                    // Most likey, you will have instance of `\WC_Order`
                    // inside this method.
                    return $this->is_order_provided() ? $this->get_order()->get_order_ovacars_pickup_date() : '';
                }
            }
            return $placeholders;
        }
    );
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment