I create a custom post type named it ‘en-ads’ and taxonomy ‘en-ads-cat’.
I create a ajax search and it showed wanted post. each of these items has a check box that if user check it that item is added to something like woocommerce cart in another page. and when click the show cart button. user can see all selected items on that cart page.
also if user wants to come back and add something new to the cart, past cart items should stored and exclude douplicate posts. also user can delete an item in cart and add new in first page.
my search page is ‘site/ooh’ and cart page is ‘site/ooh-cart’
this is the html that I get from search result:
<ul class="ajax_filter_search_results__list">
<li id="ad-1230" class="ad-item">
<img src="billboard title 1.jpg" class="ad-item__image--img">
<div class="ad-item__info">
<h4 class="ad-item__info--billboard">billboard title 1</h4>
<div class="ad-item__info--list">
<p class="ad-item__info--item">billboard title 1 state</p>
<p class="ad-item__info--item">billboard title 1 city</p>
<p class="ad-item__info--item">billboard title 1 light : yes</p>
<p class="ad-item__info--item">billboard title 1 size: 10x2</p>
<p class="ad-item__info--item">billboard title 1 date: 2023-08-10</p>
<p class="ad-item__info--item">billboard title 1 price: 30000$</p>
<label class="ad-item__info--item ad-item__info--item-label">
<input type="checkbox" value="[object Object]" class="ad-item__info--add-to-pdf">
</label>
</div>
</div>
</li>
<li id="ad-1230" class="ad-item ad-item--add-to-cart">
<img src="billboard title 2.jpg" class="ad-item__image--img">
<div class="ad-item__info">
<h4 class="ad-item__info--billboard">billboard title 2</h4>
<div class="ad-item__info--list">
<p class="ad-item__info--item">billboard title 2 state</p>
<p class="ad-item__info--item">billboard title 2 city</p>
<p class="ad-item__info--item">billboard title 2 light : no</p>
<p class="ad-item__info--item">billboard title 2 size: 50x3</p>
<p class="ad-item__info--item">billboard title 2 date: 2023-09-10</p>
<p class="ad-item__info--item">billboard title 2 price: 40000$</p>
<label class="ad-item__info--item ad-item__info--item-label">
<input type="checkbox" value="[object Object]" class="ad-item__info--add-to-pdf">
</label>
</div>
</div>
</li>
<li id="ad-1230" class="ad-item ad-item--add-to-cart">
<img src="billboard title 3.jpg" class="ad-item__image--img">
<div class="ad-item__info">
<h4 class="ad-item__info--billboard">billboard title 3</h4>
<div class="ad-item__info--list">
<p class="ad-item__info--item">billboard title 3 state</p>
<p class="ad-item__info--item">billboard title 3 city</p>
<p class="ad-item__info--item">billboard title 3 light : yes</p>
<p class="ad-item__info--item">billboard title 3 size: 50x3</p>
<p class="ad-item__info--item">billboard title 3 date: 2023-12-10</p>
<p class="ad-item__info--item">billboard title 3 price: 7000$</p>
<label class="ad-item__info--item ad-item__info--item-label">
<input type="checkbox" value="[object Object]" class="ad-item__info--add-to-pdf">
</label>
</div>
</div>
</li>
</ul>
<a href="site/ohh-cart" class="cart-page">view cart</a>
when checkbox checked that li item get class ‘ad-item–add-to-cart’. only these items must export to cart page.
how can I achieve this? Any useful help is appreciated.