Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jet booking] add a filter to is_sold_individually() in WC_Product_Jet_Booking #7404

Closed
breakerh opened this issue Mar 11, 2024 · 2 comments
Closed
Assignees

Comments

@breakerh
Copy link

breakerh commented Mar 11, 2024

I think it would be awesome to add a filter in the is_sold_individually() in WC_Product_Jet_Booking.
This allows people to enable quantity along with the text fields which already have this.

Extending the WC_Product_Jet_Booking brings some unwanted/unexpected behaviour.

Example:

	 /**
	 * Get type.
	 *
	 * Get internal type.
	 *
	 * @access public
	 *
	 * @return string
	 */
	public function get_type() {
		return 'jet_booking';
	}

	/**
	 * Is sold individually.
	 *
	 * Check if a product is sold individually (no quantities).
	 *
	 * @access public
	 *
	 * @return boolean
	 */
	public function is_sold_individually() {
		return apply_filters( 'jet_booking_sold_individually', false, $this ); // <-- Added this filter for is_sold_individually
	}

	/**
	 * Ger virtual.
	 *
	 * Set product as virtual.
	 *
	 * @access public
	 *
	 * @param string $context What the value is for. Valid values are `view` and `edit`.
	 *
	 * @return bool
	 */
	public function get_virtual( $context = 'view' ) {
		return apply_filters( 'jet_booking_get_virtual', true, $this ); // <-- Added this filter for get_virtual
	}

	/**
	 * Is purchasable.
	 *
	 * Returns false if the product cannot be bought.
	 *
	 * @access public
	 *
	 * @return bool
	 */
	public function is_purchasable() {
		return apply_filters( 'woocommerce_is_purchasable', true, $this );
	}

Would really love if this is added, and I think I can make a few people happy after that since we've made a extension which allows customers to use qty together with jet booking..

@UraraReika
Copy link
Collaborator

Thanks for the feedback.

Next 3.3.1 release version of the plugin will have such hooks. For is_sold_individually() will be added WC based woocommerce_is_sold_individually hook that used for such purpose. As for get_virtual() there is no default WC hook so in this case will be added jet-booking/wc-integration/booking-product/get-virtual the naming of the hook stands on our naming standards.

https://tppr.me/kRXGVs

But for the time being plugin will only handle default values from this methods.

Thank you for your understanding.

@Crocoblock
Copy link
Owner

was released in v3.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants